使用Terraform创建具有2个可用区的EC2多区域

时间:2019-04-24 10:26:14

标签: amazon-ec2 terraform

请有人给我一个例子,说明如何创建Terraform代码,该代码创建3个不同的区域,每个区域具有2个可用区域。

我不知道如何将可用区域添加到每个区域,并且我看不到ec2实例

    # provider.tf - Specify the provider and access details

provider "aws" {
    shared_credentials_file = "$HOME/.aws/credentials"
    profile                 = "default"
    alias                  = "Oregon"
    region                  = "us-west-2"
}

provider "aws" {
    shared_credentials_file = "$HOME/.aws/credentials"
    alias                   = "Frankfurt"
    region                  = "eu-central-1"
}

provider "aws" {
    shared_credentials_file = "$HOME/.aws/credentials"
    alias                   = "Sydney"
    region                  = "ap-southeast-2"
}

resource "aws_instance" "example" {
  ami           = "ami-2757f631"
  instance_type = "t2.micro"
}

谢谢

0 个答案:

没有答案