NEW: ec2 with ssm instance role

This commit is contained in:
xpk 2020-06-28 16:12:45 +08:00
parent c131ed84f0
commit 408efc4403
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,14 @@
resource "aws_instance" "web" {
ami = "ami-49bbfa38"
instance_type = "t3.micro"
key_name = "kfong-aws"
vpc_security_group_ids = ["sg-053612d40f966eec7"]
subnet_id = "subnet-0a4edc273558afaab"
associate_public_ip_address = true
iam_instance_profile = "AmazonSSMRoleForInstancesQuickSetup"
tags = {
Name = "kf-ssm-test"
ssm-enabled = "yes"
}
}

View File

@ -0,0 +1,10 @@
variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "aws_region" {}
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
version = ">= 2.28.1"
}