AWS Version and Release Management: Labels, Branches, and Aliases
Use labels and branches for version and release management
AWS Version and Release Management: Labels, Branches, and Aliases
This study guide focuses on the critical skill of managing application versions and releases across various AWS services. Mastering how to use labels, aliases, and branches is essential for implementing robust CI/CD pipelines, performing rollbacks, and managing multi-environment deployments (Dev, Test, Prod).
Learning Objectives
By the end of this module, you should be able to:
- Differentiate between immutable versions and mutable aliases/labels.
- Configure Lambda Aliases for traffic shifting and canary deployments.
- Implement API Gateway Stages and Stage Variables for environment-specific routing.
- Manage AWS Amplify branches to automate front-end environment provisioning.
- Apply container tagging strategies for consistent ECS/EKS deployments.
Key Terms & Glossary
- Immutable Version: A read-only snapshot of code or configuration that cannot be changed once created (e.g., Lambda Version 5).
- Alias/Label: A pointer or symbolic name that refers to a specific version (e.g., the "PROD" alias pointing to Version 5).
- Traffic Shifting: The process of gradually moving request traffic from an old version to a new version (Canary deployment).
- Stage Variable: A key-value pair in API Gateway used to dynamically change backend behavior based on the deployment stage.
- Blue/Green Deployment: A strategy where two identical environments (Blue for old, Green for new) run simultaneously to ensure zero-downtime transitions.
The "Big Idea"
The core philosophy of AWS release management is decoupling the consumer from the implementation. By using labels (like Lambda Aliases or API Gateway Stages), consumers always point to a stable name (e.g., api.example.com/prod), while developers can swap the underlying versions or branch code without breaking the connection. This enables safe testing and instantaneous rollbacks.
Formula / Concept Box
| Service | Versioning Mechanism (Immutable) | Labeling/Branching (Mutable) |
|---|---|---|
| AWS Lambda | Function Versions (1, 2, 3...) | Aliases (DEV, PROD, CANARY) |
| API Gateway | Deployments | Stages (beta, v1, prod) |
| ECR / ECS | Image Digest (SHA) | Image Tags (latest, v1.0.1) |
| AWS Amplify | Git Commit SHA | Git Branches (main, develop, feature) |
| AppConfig | Configuration Profile Version | Environment / Deployment Strategy |
Hierarchical Outline
- Lambda Versioning and Aliases
- Versions: Created via
PublishVersion. Includes code + configuration. - Aliases: Pointers to a version. Supports Routing Configuration (e.g., 90% to v1, 10% to v2).
- Versions: Created via
- API Gateway Environment Management
- Stages: Logical references to a deployment (e.g.,
prodordev). - Stage Variables: Used in integration URIs (e.g.,
arn:aws:lambda:...:${stageVariables.functionName}).
- Stages: Logical references to a deployment (e.g.,
- Container Release Management
- ECR Tags: Use immutable tags in production to prevent "latest" tag drift.
- Task Definitions: Reference specific image tags for deterministic scaling.
- AWS Amplify Branching
- Branch Mapping: Connect
mainbranch to the production URL anddevelopto the staging URL. - Feature Branching: Auto-provisioning temporary environments for Pull Requests.
- Branch Mapping: Connect
Visual Anchors
Lambda Traffic Shifting (Canary)
Multi-Environment Pipeline Flow
\begin{tikzpicture}[node distance=2cm, every node/.style={rectangle, draw, fill=blue!10, text width=2.5cm, align=center, rounded corners}] \node (code) {CodeCommit$Branch: main)}; \node (build) [right of=code, xshift=2cm] {CodeBuild$Tag: v1.2)}; \node (deploy) [right of=build, xshift=2cm] {CodeDeploy$Alias: PROD)};
\draw [->, thick] (code) -- (build);
\draw [->, thick] (build) -- (deploy);
\node [below of=code, fill=green!10] (dev) {Branch: develop};
\node [below of=deploy, fill=green!10] (dev_env) {Alias: DEV};
\draw [->, dashed] (dev) -- (dev_env);\end{tikzpicture}
Definition-Example Pairs
-
Term: Stage Variables
- Definition: Values defined at the API Gateway Stage level that act as environment variables for the API.
- Example: Defining a variable
lambdaAliasas"PROD"on the production stage. The API callsMyFunction:${stageVariables.lambdaAlias}, ensuring the production API always hits the production Lambda code.
-
Term: Amplify Feature Branching
- Definition: The ability to automatically create a unique URL and backend environment for every new Git branch.
- Example: A developer creates branch
feature-login. Amplify detects this, deploys a temporary frontend athttps://feature-login.d123.amplifyapp.com, and deletes it when the branch is merged.
Worked Examples
Example 1: Updating a Lambda Function Safely
Scenario: You have a critical Lambda function. You need to deploy a bug fix without risking downtime.
- Publish: Upload new code and call
PublishVersion. AWS assigns itVersion 12. - Test: Invoke
arn:aws:lambda:region:acc:function:my-func:12directly to verify the fix. - Update Alias: Update the
PRODalias to point toVersion 12using the CLI:aws lambda update-alias --function-name my-func --name PROD --function-version 12. - Verification: If errors spike, immediately update the alias back to
Version 11.
Example 2: API Gateway Routing with Stage Variables
Scenario: You want one API definition to point to two different DynamoDB tables based on the URL.
- Configure Stages: Create stages
devandprod. - Set Variables: In
dev, settableName = "DevTable". Inprod, settableName = "ProdTable". - Mapping: In your integration (e.g., a Lambda function or Direct Service Integration), use
${stageVariables.tableName}in the request template.
Checkpoint Questions
- Question: Can you modify the code of a Lambda Function Version after it has been published?
- Question: How do you implement a 10% canary deployment using Lambda?
- Question: If you delete an API Gateway Stage, what happens to the underlying Deployments?
- Question: In AWS Amplify, how do you protect your production environment from unauthorized changes via Git?
▶Click to see Answers
- No. Versions are immutable. You must publish a new version for any changes.
- Answer: Use a Lambda Alias with
routing-config. Set theAdditionalVersionWeightsproperty to point 0.1 (10%) of traffic to the new version. - Answer: The Deployments remain in history, but the Stage URL becomes invalid. You can re-create a stage and point it back to any existing Deployment.
- Answer: Connect the
mainbranch to the production environment and enable "Branch Protection" in your Git provider. Use Amplify's "Webhooks" or "Conditional Deploys" to ensure only reviewed code reaches production.
[!TIP] For the DVA-C02 exam, remember that Aliases are used for Lambda traffic shifting, while Stage Variables are the primary way to manage environment-specific metadata in API Gateway.