Sets up an EC2 workstation with CentOS 7 (x86_64) in ap-southeast-2
Ensure using S3 remote state
export accountId=$(aws sts get-caller-identity --query Account --output text)
terraform init \
-backend-config="region=ap-southeast-2" \
-backend-config="bucket=terraform-state-${accountId}" \
-backend-config="key=terraform.tfstate" \
-backend-config="dynamodb_table=terraform-state"
If you don't want to sync your state remotely just:
terraform init
terraform plan
terraform apply
It will run and spit out the EC2 instance ID
Install Session Manager plugin for AWS CLI first.
Start the session using the output instance_id
aws ssm start-session \
--document-name ec2-workstation \
--target i-053cc3cc379ef0069