AWS Certified Devops Engineer Professional · Free Practice Question Medium

Question 6

The DevOps team at a presentation software company is deploying their flagship application using Elastic Beanstalk. The application is deployed using a Deploy stage in a CodePipeline pipeline. The technical requirements mandate changing the configuration of the Application Load Balancer tied to Elastic Beanstalk by adding an HTTP to HTTPS redirection rule.

As a DevOps Engineer, you don't have the permissions to directly edit the Elastic Beanstalk environment, how can you proceed?

  • A

    Using the EB CLI, create a .elasticbeanstalk/saved_configs/config.yml, and specify the rules for the key aws:elbv2:listener:default. Run a deploy using the EB CLI from your computer onto the Elastic Beanstalk Environment

  • B

    Create a file named .ebextensions/alb.config in your code repository and add an option_settings block for which you will specify the Rules for the key aws:elbv2:listener:default. Push your code and let the CodePipeline run

  • C

    Create a file named .ebextensions/alb.config in your code repository and add a container_commands block for which you will specify a container command that will run in leader_only mode. The EC2 instance will issue an API call to the Load Balancer to add the redirection rule

  • D

    Using the EB CLI, create a .elasticbeanstalk/saved_configs/config.yml, and specify the rules for the key aws:elbv2:listener:default. Configure CodePipeline to deploy to Elastic Beanstalk using the EB CLI and push the code

Reveal correct answer

Correct answer: B

Explanation

Correct option:

Create a file named .ebextensions/alb.config in your code repository and add an option_settings block for which you will specify the Rules for the key aws:elbv2:listener:default. Push your code and let the CodePipeline run

You can use Elastic Beanstalk configuration files (.ebextensions) with your web application's source code to configure your environment and customize the AWS resources that it contains. Configuration files are YAML- or JSON-formatted documents with a .config file extension that you place in a folder named .ebextensions and deploy in your application source bundle. You can use the option_settings key to modify the environment configuration. You can choose from general options for all environments and platform-specific options.

via - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

Note: Recommended values are applied when you create or update an environment on the Elastic Beanstalk API by a client. For example, the client could be the AWS Management Console, Elastic Beanstalk Command Line Interface (EB CLI), AWS Command Line Interface (AWS CLI), or SDKs. Recommended values are directly set at the API level and have the highest precedence. The configuration setting applied at the API level can't be changed using option_settings, as the API has the highest precedence.

via - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html

Configuration changes made to your Elastic Beanstalk environment won't persist if you use the following configuration methods:

Configuring an Elastic Beanstalk resource directly from the console of a specific AWS service.

Installing a package, creating a file, or running a command directly from your Amazon EC2 instance.

For the given use-case, using a .ebextensions file and configuring the rules in the option_settings block is the right option.

Incorrect options:

Using the EB CLI, create a .elasticbeanstalk/saved_configs/config.yml, and specify the rules for the key aws:elbv2:listener:default. Configure CodePipeline to deploy to Elastic Beanstalk using the EB CLI and push the code - This option has been added as a distractor as you cannot configure CodePipeline to deploy using the EB CLI.

Using the EB CLI, create a .elasticbeanstalk/saved_configs/config.yml, and specify the rules for the key aws:elbv2:listener:default. Run a deploy using the EB CLI from your computer onto the Elastic Beanstalk Environment - Using the EB CLI on your computer would normally work, but here the question specifies that we don't have the necessary permissions to make direct changes against the Beanstalk environment. We, therefore, have to use CodePipeline.

Create a file named .ebextensions/alb.config in your code repository and add a container_commands block for which you will specify a container command that will run in leader_only mode. The EC2 instance will issue an API call to the Load Balancer to add the redirection rule - Using a container_command may work, but it wouldn't be best practice as the EC2 would issue a command to the ALB and therefore the configuration of it would be different from the one specified by Beanstalk itself, and the EC2 instance may not have enough permissions through IAM role to issue that command in the first place. So this option is incorrect.

References:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need