AWS CloudFormation Load Balancer Configuration

Configure Load Balancer in CloudFormation Template

Prev Question Next Question

Question

You are writing a CloudFormation template to configure multiple AWS resources including an application load balancer.

You need to launch the load balancer in two availability zones that have more free IP resources.

How would you configure the load balancer in the CloudFormation template?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - A.

Option A is CORRECT: Because you need to use Subnets or SubnetMappings for the application load balancer resources in CloudFormation.

Subnets from at least two availability zones must be specified for application load balancers.

Option B is incorrect: Availability zone names should not be used in this scenario.

Option C is incorrect: Because you should use Subnets or SubnetMappings rather than the availability zone IDs.

Option D is incorrect: Because you must specify either Subnets or SubnetMappings for application load balancer resources.

Reference:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html

To configure an application load balancer to launch in two availability zones with free IP resources using a CloudFormation template, you should:

A. Specify two subnet IDs that belong to two availability zones in the template.

When creating a CloudFormation template, you can specify two subnets for the application load balancer to be launched in two availability zones that have more free IP resources. A subnet is a subdivision of an IP network and a VPC (Virtual Private Cloud) is divided into several subnets that are deployed across multiple availability zones. By specifying two subnets that belong to different availability zones in the CloudFormation template, you ensure that the application load balancer is launched in two availability zones.

B. Specify the availability zone names in the template such as ap-southeast-2a and ap-southeast-2b.

While it is possible to specify the availability zone names in the CloudFormation template, this is not recommended as the availability zone names may change over time. Instead, it is recommended to use the availability zone IDs as they are more stable.

C. Use the availability zone IDs in the template such as apse2-az1 and apse2-az2.

Using availability zone IDs in the CloudFormation template is a recommended approach. An availability zone ID is a unique identifier for an availability zone that remains the same over time. This ensures that the application load balancer is always launched in the same availability zones.

D. No actions required as CloudFormation automatically selects two availability zones that have more resources for the load balancer.

While CloudFormation does select two availability zones when creating resources, it cannot ensure that these availability zones have more free IP resources. Therefore, it is recommended to specify the subnets or availability zone IDs to ensure the application load balancer is launched in the desired availability zones.