Certopolis

AWS Certified DevOps Engineer – Professional

AWS AppConfig deployment strategies, bake time and validators

An AppConfig deployment strategy sets how fast a configuration reaches its targets and how long AppConfig keeps watching afterwards. The AWS AppConfig User Guide says that if a CloudWatch alarm on the environment fires during the deployment or its bake time, AppConfig rolls the configuration back. Validators check the configuration data before it is deployed.

What does a deployment strategy define?

The deployment type is linear or exponential. Linear moves in equal increments of the step percentage, spread evenly over the deployment time. Exponential uses the formula G*(2^N), so a growth factor of 2 reaches 2 percent of targets, then 4 percent, then 8 percent, and so on.

Deployment time is the window over which AppConfig deploys in intervals. It is not a timeout. Bake time is how long AppConfig monitors CloudWatch alarms after the configuration has reached 100 percent of targets, before it treats the deployment as complete. An alarm during bake time triggers a rollback.

Which predefined strategy fits?

AppConfig.Linear20PercentEvery6Minutes deploys to 20 percent of targets every six minutes for 30 minutes, then monitors alarms for 30 minutes. AppConfig.Canary10Percent20Minutes deploys exponentially with a 10 percent growth factor over 20 minutes, then monitors for 10 minutes. AWS recommends both for production.

AppConfig.AllAtOnce deploys to all targets immediately and still monitors alarms for 10 minutes. AppConfig.Linear50PercentEvery30Seconds deploys to half of the targets every 30 seconds with a 1-minute bake time. AWS recommends it only for testing or demonstrations.

How do rollback and validation work?

Alarms are attached to the environment, which is a logical group of targets such as a Production environment. AppConfig needs an IAM role that lets it call cloudwatch:DescribeAlarms. If one of the listed alarms goes into the ALARM state during a deployment, AppConfig rolls the configuration back.

A configuration profile can have up to two validators. A JSON Schema validator is supported for free-form configurations. A Lambda function validator is supported for feature flags and free-form configurations, and receives the configuration content as a base64-encoded string.

AppConfig decides whether a Lambda validator failed by checking for the X-Amz-Function-Error header in the response. Lambda sets that header when the function throws an exception. A function that finishes normally counts as a successful validation, whatever it returns.

Where the exam catches people

  • Believing a Lambda validator fails a configuration by returning false: AppConfig looks for a function error, so the function must throw an exception.
  • Believing AppConfig.AllAtOnce has no rollback: it still monitors alarms for a 10-minute bake time.
  • Believing bake time starts when the deployment starts: it starts after the configuration has reached 100 percent of targets.
  • Believing deployment time is a timeout: it is the window over which the deployment is processed in steps.
  • Believing alarms are attached to the deployment strategy: they are configured on the environment, with an IAM role AppConfig can use to read them.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A company deploys a freeform JSON configuration with AWS AppConfig. The configuration profile has an AWS Lambda validator that checks each discount rule against a partner contracts table. When a rule is invalid, the function returns a JSON response body containing valid set to false and the reason. Last week a configuration with an invalid rule passed validation and reached production. The validator must block any configuration that fails its checks before the deployment changes any target. What should a DevOps engineer do to meet these requirements?

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: B is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    A function that returns valid false finishes normally, so AppConfig treats the configuration as valid. Raising an exception on an invalid rule makes the check fail, and AppConfig then stops the deployment before any target changes.

    Written from docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile-validators.html

  2. A company uses AWS AppConfig to deploy a feature flag that turns off a failing payment provider. During an incident the flag change must reach every target immediately. If the error-rate alarm on the AppConfig environment enters the ALARM state in the 10 minutes after every target has the change, AppConfig must roll the change back automatically. AppConfig already has an IAM role that lets it read the alarm. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: C is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The predefined AppConfig.AllAtOnce strategy delivers to all targets at once and then monitors for 10 minutes, so it is immediate and still rolls back if the error-rate alarm fires in that window.

    Written from docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html

  3. A company's checkout service runs on 250 Amazon EC2 instances that are AWS Systems Manager managed nodes. The service reads its throttling and retry settings from a JSON file on each instance, and its code will not be changed. Operations staff change these settings several times a day during sales events. Last month one bad value reached every instance at once, and it took 40 minutes to put the old file back by hand. Each change must now reach a few instances at a time, and a change must be undone without anyone acting if the checkout error-rate alarm fires. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Configuration Management and IaC building.

    Not that one: C is right. In the game your Configuration Management and IaC building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    That is what AWS AppConfig is for. A linear deployment strategy sets the pace, the environment's CloudWatch alarm triggers rollback during the deployment and its bake time, and AWS AppConfig Agent on each instance serves the deployed version. The agent's manifest can write each deployed configuration to a file path, so the service keeps reading its JSON file unchanged.

    Written from docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-deployment-strategy.html

Ask for something