AWS FSx ONTAP集群和 EC2 实例配置
NetApp解决方案工程团队
该解决方案提供了基于 Terraform 的自动化工具包,用于配置 FSx ONTAP集群和 EC2 计算实例。
目的
该工具包可自动执行 AWS FSx ONTAP存储集群和 EC2 计算实例的配置任务,随后可用于数据库部署。
此解决方案适用于以下用例:
-
在预定义的 VPC 子网中的 AWS 云中配置 EC2 计算实例,并将用于 EC2 实例访问的 ssh 密钥设置为 ec2-user。
-
在所需的可用区域中配置 AWS FSx ONTAP存储集群,并配置存储 SVM 并设置集群管理员用户 fsxadmin 密码。
受众
此解决方案适用于以下人群:
-
在 AWS EC2 环境中管理数据库的 DBA。
-
对 AWS EC2 生态系统中的数据库部署感兴趣的数据库解决方案架构师。
-
管理支持数据库的 AWS FSx ONTAP存储的存储管理员。
-
喜欢在 AWS EC2 生态系统中建立数据库的应用程序所有者。
许可证
通过访问、下载、安装或使用此 GitHub 存储库中的内容,您同意"许可证文件"。
|
制作和/或共享此 GitHub 存储库中内容的任何衍生作品都受到某些限制。请确保在使用该内容之前阅读许可条款。如果您不同意所有条款,请不要访问、下载或使用此存储库中的内容。 |
解决方案部署
部署先决条件
Details
部署需要以下先决条件。
An Organization and AWS account has been setup in AWS public cloud An user to run the deployment has been created IAM roles has been configured IAM roles granted to user to permit provisioning the resources
VPC and security configuration A VPC has been created to host the resources to be provisioned A security group has been configured for the VPC A ssh key pair has been created for EC2 instance access
Network configuration Subnets has been created for VPC with network segments assigned Route tables and network ACL configured NAT gateways or internet gateways configured for internet access
下载工具包
Details
git clone https://github.com/NetApp/na_aws_fsx_ec2_deploy.git
连接和身份验证
Details
该工具包应该从 AWS 云壳执行。 AWS 云壳是一个基于浏览器的壳,可以轻松安全地管理、探索和与 AWS 资源交互。 CloudShell 已使用您的控制台凭证进行预先身份验证。常用的开发和操作工具已预先安装,因此无需本地安装或配置。
Terraform provider.tf 和 main.tf 文件配置
Details
provider.tf 定义 Terraform 通过 API 调用提供资源的提供商。 main.tf 定义了要配置的资源和资源的属性。以下是一些详细信息:
provider.tf: terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.54.0" } } }
main.tf: resource "aws_instance" "ora_01" { ami = var.ami instance_type = var.instance_type subnet_id = var.subnet_id key_name = var.ssh_key_name root_block_device { volume_type = "gp3" volume_size = var.root_volume_size } tags = { Name = var.ec2_tag } } ....
Terraform Variables.tf 和 terraform.tfvars 配置
Details
Variables.tf 声明了在 main.tf 中要使用的变量。 terraform.tfvars 包含变量的实际值。以下是一些示例:
variables.tf: ### EC2 instance variables ###
variable "ami" { type = string description = "EC2 AMI image to be deployed" }
variable "instance_type" { type = string description = "EC2 instance type" }
terraform.tfvars:
# EC2 instance variables
ami = "ami-06640050dc3f556bb" //RedHat 8.6 AMI
instance_type = "t2.micro"
ec2_tag = "ora_01"
subnet_id = "subnet-04f5fe7073ff514fb"
ssh_key_name = "sufi_new"
root_volume_size = 30
逐步程序 - 按顺序执行
Details
-
在 AWS 云壳中安装 Terraform。
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
mkdir ~/bin
ln -s ~/.tfenv/bin/* ~/bin/
tfenv install
tfenv use 1.3.9
-
从NetApp GitHub 公共站点下载工具包
git clone https://github.com/NetApp-Automation/na_aws_fsx_ec2_deploy.git
-
运行 init 来初始化 terraform
terraform init
-
输出执行计划
terraform plan -out=main.plan
-
应用执行计划
terraform apply "main.plan"
-
完成后运行 destroy 以删除资源
terraform destroy
在哪里可以找到更多信息
要了解有关NetApp解决方案自动化的更多信息,请访问以下网站"NetApp解决方案自动化"