These examples accompany my AWS Community Day Instanbul 2023 talk. Optimising EC2 AutoScaling Groups in CloudFormation
- AWS Account
- AWS Credentials with permissions to run CloudFormation, create VPCs, IAM Role, AutoScaling Groups etc.
- AWS CLI tools installed
- EC2 Key Pair created
Checkout this github repo.
From the AWS Console, locate the name of the EC2 KeyPair you wish to use and add keep it for the Initial Setup.
Decide on a CIDR to use for the example VPC (temporary, you can delete it later).
Currently support a 10.x.0.0/16
CIDR. So substitue a number for x
cd example-vpc
make update-parameter NAME=/base/example/ec2-keyname VALUE=<<Insert Key name here>>
make update-parameter NAME=/example-vpc/cidr VALUE=<<CIDR here. e.g. 10.10.0.0/16>>
make update-parameter NAME=/example-vpc/single-nat VALUE=true
That last parameter single-nat
will create a single EC2 NAT Gateway instance. An amz2-arm64
t4g.micro
instance.
Set the value to false
and it will create 3 instances, one for AZs a
, b
and c
instead.
Once the above parameters are set run
make create-stack
After a couple of minutes, the VPC should be created.
make show-outputs
should then list the VPC and subnet details.
From the checkout root.
cd example-vpc
make set-default-params
This will create a default set of parameters for using the example template.
Run:
make show-ssm-parameters
to view the settings.