Brook Preloader


Release Management Process in AWS!!!

It’s an AWS’some day for me to share my knowledge on the indispensable process of a serverless application using AWS.

Amazon Web Services (AWS) is a secure cloud services platform offering to compute power, database storage (ie, no memory leakage), Serverless Application building, content delivery, and other functionality to help businesses scale and grow.The AWS cloud platform offers over 165 fully featured services, including over 40 services that aren’t available anywhere else.

Myriad of customers are currently leveraging AWS cloud products and solutions to build sophisticated applications with increased

  • Flexibility — Able to change so as to adapt to different circumstances and provides all technology skillset (changing the technologies as per the requirement).
  • Scalability — Adjusts the capacity of Memory allocation as needed.
  • Reliability — Can be run on any platform.

What is the Release Management Process???

It is the processof managing, planning, scheduling and controlling a software build through different stages and environments, including testing and deploying software releases.

Why do we need the Release Management Process???

  1. Accelerated Time to Value (TtV) — It’s the time between a business request and the initial delivery of that request. End users realize the benefits of changes a quickly as possible with the help of TtV.
  2. Higher Release Throughput — By absorbing higher rates of change to systems while maintaining IT service quality through a unified, well-understood and controlled release process.
  3. Supplement Agility and Flexibility — This helps to use services at your own pace, adapt your consumption and use tools to meet your needs.
  4. Eliminate duplicate and manually intended activities — In the plan, manage and deploy stage of the release process. Also, eliminate the need to continual reconcile inconsistent information sources from day to day activities.
  5. Increased Productivity — Deliver smoother transitions of releases from development activities (projects) to final destination environment.
  6. Mitigate release failure — Spreading your nodes evenly across Availability Zones will minimize the impact in the unlikely event of an AZ failure.

Before going into the process, let’s have a look at the keywords used for better and easy understanding.

  1. IAM: Also called Identity and Access Management enables you to manage access to AWS services and resources securely. Using IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources.

2. RESOURCE: A Resourceis an entity that you can work with. For example like Amazon EC2 instance, an AWS CloudFormation stack, or an Amazon S3 bucket.

3. ROLE: A role is an IAM entity that specifies a set of permissions that you can use to access AWS resources that you need. However, these IAM roles or AWS services can assume a role to obtain temporary security credentials that can be used to make AWS API calls. Consequently, one doesn’t need to share long-term credentials or define permissions for each entity that requires access to a resource.

4. LAMBDA FUNCTION: AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic or create your own back-end services that operate at AWS scale, performance, and security.

5. VERSIONING: Versioning is simply keeping multiple variants of an object in the same bucket. Versioning enabled buckets allows us to recover objects from accidental deletion or overwrite I.e, it allows us to preserve, retrieve, and store every version of every object that is stored.

6. ALIASES: An AWS Lambda alias is like a pointer to a specific Lambda function version.

7. REST API: REST API also called as Representational State Transfer Application Programming Interface is a software architectural style that defines a set of constraints to be used for creating Web services. The developer creates the API on the server and allows the client to talk to it. It is a set of rules that developers follow when they create their API.

8. API GATEWAY: Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring and securing REST and WebSocket APIs at any scale. It allows a developer to connect non-AWS applications to AWS back-end resources such as servers or code.

How do we do the Release Management Process???

Let’s dive deep into the step by step process of RMP in AWS.

1) Creating a role

Go to AWS Console → Search for IAM or click on IAM available in Security, Identity and Compliance Service → Click on “Role” (on the left sidebar, Fig.1 — Red color) → Click on “Create Role” (Fig.1 — Green color) → Choose Lambda as your service that will use the created role as “LAMBDA” → Click “Next: Permission” → Search and select the policies (six policies) stated below (Fig.2, in red color)→ Click “Next: Tags” → Click “Next: Review” → Give your Role name → Click “Create Role” (Fig.2).

This creates a role in IAM and displays something like Fig.3.

2) Creating a Lambda Function

AWS Console → Lambda (from Compute Service) → Click “Create function” → Give the basic information (Fig.4) → give you lambda function name → Choose your language (python 3.6) → Click on “Choose or create an execution role” → Select “Choose an existing role” → Select the role which you have created in IAM → click “Create function”.

Lambda function is created! ( See Fig.5 )

Now Click “MyAPIGateway” (nothing but your Lambda Function name — I have given as MyAPIGateway for ref) (Fig.6, in red color) → on selecting “Configure test events” (Fig.6, in green color) opens a pop up (Fig.7) → give your “Event Name” (Fig.7). Remove Key & Values (not necessary) and Click “Create”. Now test the lambda function (Fig.6, in yellow color) and see the execution details (Fig.8, green color).

Fig.6 Routing for configuring the test event

Fig.8 Lambda Test Execution

You can see Amazon Resource Names (ARNs)(Fig.8, in red color) uniquely identify AWS resources help you track and use AWS items and policies across AWS services and API calls.

3) Publishing new Version

AWS Console → Lambda (from Compute service) → Click “Your Lambda Function” (the name of the Lambda Function which you have given while creating) → Click “Actions” (Fig.9, in red color) → Select “Publish new Version” (Fig.9, in green color) → Give your Version Description (Some description — Fig.10, in red color) → Click “Publish” (Fig.10, in green color).

Now go to “Qualifier” (Fig.11, in red color) → Click “Versions” (Fig.9, in green color) → Select “$latest”→ Give the below code (in the Sample code below) in the .py file of the function code→ Click “Save” (Fig.8).

Sample Code:

import json
print(‘Invoked Lambda function for my_APIGateway — DEV!’)
print(‘Invoked Lambda function for my_APIGateway — DEV!’)
def lambda_handler(event, context):
# TODO implement

print(‘Before if condition!’)
msg = ‘Invoked Lambda function for my_APIGateway — DEV!’
return {
‘statusCode’: 200,
‘body’: json.dumps(msg)

Now Click “Actions” (Fig.9, in red color) → Select “Publish new Version” (Fig.9, in green color) → Give your Version Description (Fig.10, in red color) → Click “Publish” (Fig.10, in green color).

Repeat the 3) “Publishing new version” by changing the content in printf statement to “QA” and “PROD” and finally create “DEV”, “QA”, and “PROD” (three) versions (Fig.12).

4) Creating new Aliases for the Versions created

AWS Console → goto Lambda (from Compute service) → Click “Your Lambda Function” → Click “Actions” (Fig.9, in red color) → on selecting “Create Alias” shows a modal pop up as in Fig.13 → Give Alias Name and Description (Fig.13) → Select your Version (which you have created for the three stages — Fig.13, in red color) → Click “Create” (Fig.13, in green color).

Thus, you can see the Alias created in Fig.14.

Also, Fig.15 gives the detail of Versions w.r.t which the alias names are given.

Note: Test the three versions just for checking purpose.

5) Creating new REST API

AWS Console → goto API Gateway (from Networking and Content Delivery service) → Click “Create API” (Fig.16, in red color) → Give API name and description (Fig.17, in red color) → Click “Create API” (Fig.17, in green color).

This creates an API with your given API name as shown in Fig.18 (Green color).

5.1 Creating a Resource

AWS Console → API Gateway (from Networking and Content Delivery service) → Click your created API (Fig.18, in green color) → Click “Actions” (Fig.18) → Click “Create Resource” (Fig.18, in red color) → Give “Resource Name” (Fig.19, in red color) → Click “Create Resource” (Fig.19, in green color).

This creates your Resource (Fig.20).

5.2 Creating a Method

AWS Console → API Gateway (from Networking and Content Delivery service) → Click on your created API → Click “Actions” → Click “Create Method” (Fig.18, in red color) → Select your method from the dropdown (Fig.21, in green color) → Click on Tick mark.

This creates your Method (Fig.21).

5.3 Adding permissions to Lambda Function

Click on your method name (Fig.21, your selected method) and give the lambda function (Fig.22, in red color) as

“myAPIGateway:${stageVariables.lambdaAlias}” where

  • myAPIGateway: Lambda Function name.
  • stageVariables: Name-Value pair that you can define as the configuration attribute associated with a deployment stage of a REST API.
  • LambdaAlias: Name of the Alias, using which you can access your Lambda Function.

Here, we are defining integration for the created method using Lambda Function.

And then, on clicking “SAVE” (Fig.22, in green color) displays a pop up “Add permission to Lambda Function” (Fig.23). Copy the command displayed in the popup and save it in a new notepad/document. Click “OK” in the popup.

5.4 Deploying the created REST API into API Gateway

AWS Console → API Gateway (from Networking and Content Delivery service) -> Click your created API → Click “Actions” → Click “Deploy API” (Fig.18, in blue color) → Click on “[New stage]” (Fig.24) in Development stage dropdown → Give Stage name → Give Stage description → Development Description → click “Deploy API” (Fig.24).

On clicking “Deploy API”, it takes you to the “Stages” of the same API from “Resources” (Just for observation).

Now select “Stage Variables” (Fig.25, shown in blue color) in DEV “Stage Editor” → on clicking “Add stage variable” (Fig.25, shown in green color) shows a something like in Fig.26.

Now Give the Name and Value in the Stage Variables as shown (Fig.26, in red color), and click on Tick mark (Fig.26, in green color).

Following the same steps (5.4), deploy PROD and QA deployment stages (Fig.27, shown in green color).

Name in Stage Variables is same for all the three stages whereas, for value, we need to give the Alias name which we have created for respective Version for each stage which is nothing but QA for QA, DEV for DEV and, PROD for PROD.

On deploying the three stages, you can see something like in Fig.27(in green color).

6) Commands to be run on Command Prompt

Before going to the commands, first, let us make our stage commands ready!

6.A For easy understanding of URL’s, proceed with the following:

Step 1:

Copy the URL given in the popup displayed in the “Add permission to the Lambda Function” (Fig.23) in a Notepad or Notepad++.

Step 2:

Copy the same and paste it three times (for three stages — DEV, PROD, and QA).

Step 3:

Now change the stage name in the — function name (in the URL from Fig.23) i.e,

From :

— function-name “arn:aws:lambda:us-east-1:840152829074:function:myAPIGateway:${stageVariables.lambdaAlias}

To :

— function-name “arn:aws:lambda:us-east-1:840152829074:function:myAPIGateway:DEV

Step 4:

Now change the method (given in bold letters below — Get call)) in –source arn i.e,

From :

— source-arn “arn:aws:execute-api:us-east-1:840152829074:wh151dxedf/*/GET/mygateway”

To :

— source-arn “arn:aws:execute-api:us-east-1:840152829074:wh151dxedf/*/*/mygateway”

Note: This change of particular method to “*” gives access to all the method in the resource of that particular REST API.

Step 5:

Repeat steps 3 & 4 for PROD and QA stages.

Now, give the below commands in the command prompt.

6.1 PIP Install

Command: pip install awscli

AWS CLI (Amazon Web Services Command Line Interface) is a tool that pulls all the AWS services together in one central console, giving you easy control of multiple AWS services with a single tool.

6.2 AWS Configure

Command: aws configure

(Here, provide your AWS Access Key ID, AWS Secret Access Key, and Default Region Name).

AWS Config is a service that enables you to assess, audit, and evaluate the configurations of your AWS resources. Config continuously monitors and records your AWS resource configurations and allows you to automate the evaluation of recorded configurations against desired configurations.

6.3 Command for DEV stage: (For reference only, enter your prepared URL’s as mentioned in 6.A)

aws lambda add-permission — function-name “arn:aws:lambda:us-east-1:840152829074:function:myAPIGateway:DEV” — source-arn “arn:aws:execute-api:us-east-1:840152829074:wh151dxedf/*/*/mygateway” — principal — statement-id 8ca01308-d46d-4f0a-acab-523965dc8c6d — action lambda:InvokeFunction

6.4 Command for PROD stage: (For reference only, enter your prepared URL’s as mentioned in 6.A)

aws lambda add-permission — function-name “arn:aws:lambda:us-east-1:840152829074:function:myAPIGateway:QA” — source-arn “arn:aws:execute-api:us-east-1:840152829074:wh151dxedf/*/*/mygateway” — principal — statement-id 8ca01308-d46d-4f0a-acab-523965dc8c6d — action lambda:InvokeFunction

6.5 Command for QA stage: (For reference only, enter your prepared URL’s as mentioned in 6.A)

aws lambda add-permission — function-name “arn:aws:lambda:us-east-1:840152829074:function:myAPIGateway:PROD” — source-arn “arn:aws:execute-api:us-east-1:840152829074:wh151dxedf/*/*/mygateway” — principal — statement-id 8ca01308-d46d-4f0a-acab-523965dc8c6d — action lambda:InvokeFunction

On the success of compilation gives the result as in Fig.28.

Note: Your URL’s will be different and unique w.r.t your lambda function name, Id’s, region name and Gateway name.

7) Code Execution

Now goto API Gateway (from Networking and Content Delivery service) → Click your created API → Select Method from Resource → Click “Test” (Fig.29, in red color) → Give the stage name in Stage Variables (Fig.30, shown in dark blue color) → Click “Test”.

This gives the output (Fig 30, shown in green color) of the code you have given in the .py file of Function Code by invoking the API.

Similarly test for the other two stages namely PROD and QA by entering the respective stage Variables as PROD and QA and click on TEST.

Hope this information helps and enlightens on the Release Management Process in Amazon Web Services.

Happy reading! Post your comments below.

0 0 vote
Inline Feedbacks
View all comments