Course: CompTIA Cloud+ CV0-004
Objective: Learn to provision infrastructure using IaC toolsβin this lab, AWS CloudFormation.
CloudFormation allows you to model and provision AWS resources using JSON or YAML templates. These templates are declarative and reusable, helping enforce consistency and compliance.
β Checkpoint: Know what a CloudFormation template is and when to use one.
Create a file named simple-ec2.yaml:
AWSTemplateFormatVersion: '2010-09-09'
Description: Simple EC2 instance with security group
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
InstanceType: t2.micro
ImageId: ami-0c02fb55956c7d316 # Amazon Linux 2 in us-east-1
KeyName: cloudplus-key
SecurityGroups:
- !Ref EC2SecurityGroup
EC2SecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable SSH
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
β Checkpoint: Validate your YAML file using a linter or CloudFormation designer.
simple-ec2.yaml CloudPlusLab8 β Checkpoint: A new EC2 instance and security group are created.
CloudPlusLab8 stack β Checkpoint: Stack and all associated resources are removed.