This is a sample project called 'AWS-cloudformation-EC2-Creation-template'. This is to demonstrate using Cloudformation, how to create an instance with the existing VPC and Subnet.
This is a sample template which creates an EC2 Instance, using existing VPC & Subnet and assign a public ip
Amazon link for installing AWS CLI
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
region = eu-west-2
aws cloudformation validate-template --template-body file://./Launch_EC2_Instance_Sample_Config.yaml
aws cloudformation create-stack --stack-name ec2-test-stack --template-body file://./Launch_EC2_Instance_Sample_Config.yaml
aws cloudformation update-stack --stack-name ec2-test-stack --template-body file://./Launch_EC2_Instance_Sample_Config.yaml
aws cloudformation create-change-set --stack-name ec2-test-stack --template-body file://./Launch_EC2_Instance_Sample_Config.yaml --change-set-name port-update --description "updating the lambda function name"