Lab 01 | Introductory Example
- We're going to create a simple EC2 instance.
- Then we're going to create to add an Elastic IP to it
- And we're going to add two security groups to it
Implementation
AWS CloudFormation Template reference (opens in a new tab)
Create a YAML file.
L01_1-simple_ec2.yaml
Resources:
MyInstance:
Type: AWS::EC2::Instance
Properties:
AvailabilityZone: us-east-1a
ImageId: ami-a4c7edb2
InstanceType: t2.micro
Here in the YAML file -
Property | Description |
---|---|
Resources | Defines the AWS resources in this CloudFormation template. |
MyInstance | Name of the logical ID for our CloudFormation. |
Type | Type of AWS resource, here it's an EC2 instance. |
Properties | Contains basics settings for the EC2 instance. |
AvailabilityZone | The specific zone (us-east-1a ) where the EC2 instance will run. |
ImageId | The ID of the AMI (Amazon Machine Image) used to launch the instance. |
InstanceType | The size/type of the EC2 instance (t2.micro is a small instance). |