
AWS Certified Developer - Associate
Get started today
Ultimate access to all questions.
A developer is tasked with configuring an Amazon EC2 Auto Scaling Group that must launch both Spot and On-Demand instances depending on the specific needs of the application. It is also essential that the CodeDeploy agent is automatically installed on these EC2 instances upon launch. All instances will be running the Amazon Linux operating system.
What method would provide the most operational efficiency in meeting this configuration requirement?
A developer is tasked with configuring an Amazon EC2 Auto Scaling Group that must launch both Spot and On-Demand instances depending on the specific needs of the application. It is also essential that the CodeDeploy agent is automatically installed on these EC2 instances upon launch. All instances will be running the Amazon Linux operating system.
What method would provide the most operational efficiency in meeting this configuration requirement?
Explanation:
Overall explanation Correct option:
Use launch templates to configure the EC2 Auto Scaling Group for On-Demand and spot instances. When you create a launch template use the User data field to add a configuration script that runs when the instance starts. This shell script can, in turn, install the CodeDeploy agent
A launch template specifies instance configuration information that includes the ID of the Amazon Machine Image (AMI), the instance type, a key pair, security groups, and other parameters used to launch EC2 instances. Defining a launch template instead of a launch configuration allows you to have multiple versions of a launch template.
When you create a launch template, you can use the User data field to add a configuration script that runs when the instance starts. This shell script installs the CodeDeploy agent for all AWS Regions and supported Amazon Linux and Ubuntu distributions. You can configure CodeDeploy to auto-update on boot by setting the AUTOUPDATE variable to true.
Incorrect options:
Use launch configurations to configure the EC2 Auto Scaling Group for On-Demand and spot instances. Add the shell script to the Launch configuration tab on the AWS console. This shell script will install the CodeDeploy agent - This statement is incorrect. Not all Amazon EC2 Auto Scaling features are available when you use launch configurations. For example, you cannot create an Auto Scaling group that launches both Spot and On-Demand Instances or that specifies multiple instance types. You must use a launch template to configure these features. AWS strongly recommends not using launch configurations anymore.
Use AWS Systems Manager for installing and updating the CodeDeploy agent automatically for Spot and On-Demand instances - AWS Systems Manager also uses launch templates to automatically deploy CodeDeploy agent. However, for this use case, SSM is not operationally efficient since SSM agent needs to be installed first on all EC2 instances and then you can install the CodeDeploy agent.
Configure AWS Resource Access Manager(RAM) to schedule the automatic installation of CodeDeploy agent on the EC2 instances. RAM automatic schedules work on only Linux machines and not on Windows operating systems - AWS RAM helps you securely share your resources across AWS accounts, within your organization or organizational units (OUs), and with IAM roles and users for supported resource types. You can use AWS RAM to share resources with other AWS accounts. This eliminates the need to provision and manage resources in every account. RAM cannot be used to install the CodeDeploy agent, so this option is incorrect.