Installation: https://www.decodingdevops.com/how-to-install-terraform-on-windows-10-or-8-or-7/
Create a .tf file
provider "aws" {
region = "us-east-1"
}
cd to the folder where .tf file resides, run "terraform init" and terraform will downlaod the aws provider to local diretory
terrform aws provider cli : https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

Create IAM account at AWS cloud, and simply assign it the admin role to have all acess


Use following script to create S3
provider "aws" {
region = "us-east-1"
access_key = "AKIA***"
secret_key = "hMHx***"
#shared_credentials_file="E:/K8S/FromAppToK8S/Script/KubeK8S/Terraform"
#profile = "mattcoder1"
}
resource "aws_s3_bucket" "s3-matt-bucket"{
bucket = "s3-matt-bucket"
}

Using terraform console for query

AWS Region - Availability Zone - VPC (Virtual private cloud)
1 Region - 1 VPC - Mutltiple AZ


Use terraform to create EC2 instance
Firstly collect all required info
Region - us-east-1
vpc-id:vpc-b040eecd
instance type:
Amazone Machine Image (AMI): ami-047a51fa27710816e
Type:t2.micro
access_key = "AKIA***"
secret_key = "hMHx***"



Generate a key pair for EC2 that is going to be created


浙公网安备 33010602011771号