Exercise 4: Cloud Formation Template for Application Load Balancer
In
This Exercise, we are going to create Application Load Balancer using the Cloud
Formation Template written in YAML format. For this exercise, we need to keep
few things ready.
1.
VPC
(Default or Custom)
2.
Public
Subnets
3.
Security
Groups
We
are going to create a load balancer in Mumbai Region (ap-south-1), so we have configured
VPC with public subnets (already configured in case of the default VPC) and the security
group is configured with Port 80 and 443 inbound, we need to select subnets for each Availability
Zone so that load balancer would route traffic to those subnets.
To get the Stack click on the link: Without SSL or With SSL and save it to server say under /opt directory.
1. Login to AWS Management Console. AWS Console
2. On Management Console click on “Cloud Formation” under the “Management and Governance” section.
3. Now you will land on Cloud Formation
Console. In Cloud Formation Console click on the “Create Stack” button.
Now
follow the below steps to create a stack for this exercise
Step 1: Specify template
In
this section choose the “Template is Ready” button and select “Upload a
template file”. Now choose a file to upload from your personal computer where
it is saved and upload. Now click on next.
Step 2: Specify stack
details
Now
Specify “Stack name” for e.g. Say “ALBStack” for this exercise. Now provide the
values for parameters need to create Application Load Balancer stack, here we are giving the below
parameter values.
1.
MyELBSecurityGroups: sg-xxxxxxxxxx(Value to be replace)
2.
VPCId: vpc-xxxxxxxxxx (Values to be replace)
3. MySubnetId: subnet-xxxxxxxxxx, subnet-xxxxxxxxxx, subnet-xxxxxxxxxx (Values to be replace)
Step 3: Configure stack
options
On
the “Configure stack options” page leave all settings default and click on next.
Step 4: Review Stack
In
this step review all the settings that you have filled in and then click create
stack.
After
some time stack will be created and you can view and access resources created by
the cloud formation stack.
Click
below to get started
|
We
can also create a stack using AWS CLI
AWS CLI for creating
stack:
Note: Replace Template file name accordingly.
1. To validate cloud formation template template
#aws cloudformation validate-template --template-body file:///<path-to-file>/CFNCreateALBwithOutput.yml
2. To create stack
#aws cloudformation create-stack --stack-name ALBStack --template-body
file:///<path-to-file>/CFNCreateALBwithOutput.yml --parameters
ParameterKey=MyELBSecurityGroup,ParameterValue=sg-09f534dac79a40ce2
ParameterKey=VPCId,ParameterValue=vpc-xxxxxxxxxx
ParameterKey=MySubnetId,ParameterValue=subnet-03a896945c3e5eb15\\,subnet-0a8957bd1f2621bf1\\,subnet-01e4eb75db170e6f8
3. To describe stack
#aws cloudformation describe-stacks --stack-name ALBStack
4. To view the stack events
#aws cloudformation describe-stack-events --stack-name ALBStack
5. To delete the stack
#aws cloudformation delete-stack --stack-name ALBStack
This completes internet facing Application LoadBalancer creation using a cloud formation template with various parameters.
No comments:
Post a Comment