CloudFormation

Import Free-Tier EC2 instance configuration in CloudFront

Step 1. Create the CloudFormation YAML file AWSTemplateFormatVersion: '2010-09-09' Description: My Free Tier Parameters: KeyPair: Description: Select KeyPair Name. Type: AWS::EC2::KeyPair::KeyName Resources: DefaultVPC: Type: 'AWS::EC2::VPC' DeletionPolicy: Retain Properties: CidrBlock: '172.31.0.0/16' Tags: - Key: 'Name' Value: 'atlex00-default-VPC' DefaultSubnet: Type: 'AWS::EC2::Subnet' DeletionPolicy: Retain Properties: CidrBlock: '172.31.0.0/20' Tags: - Key: 'Name' Value: 'atlex00-default-subnet' VpcId: !Ref DefaultVPC FreeEC2Instance: Type: 'AWS::EC2::Instance' DeletionPolicy: Delete Properties: ImageId: "ami-05d34d340fb1d89e5" InstanceType: t2.micro SubnetId: !Ref DefaultSubnet BlockDeviceMappings: - DeviceName: '/dev/xvda' Ebs: VolumeType: 'gp2' VolumeSize: 8 Tags: - Key: 'Name' Value: 'free-tier' SecurityGroupIds: - !

CloudFormation - Tutorial with an EC2 instance

Important terminology Stack A stack is a collection of AWS resources that you can manage as a single unit. In other words, you can create, update, or delete a collection of resources by creating, updating, or deleting stacks. Resource Unbreakable components, like an EC2 instances, a routing table, VPC, Lambda function, etc. The form of template file The official document was quite comprehensive for me. Parameters: myparam: Type: String Default: foo .