AWS, Cloud Computing, DevOps

2 Mins Read

Step by Step Procedure for Automating Lambda Deployment using Jenkins

Voiced by Amazon Polly

Amazon provides end-to-end solutions for continuous integration and continuous deployment where its services like AWS CodeCommit, AWS CodeDeploy can be leveraged. You can also install Jenkins on EC2 and automate the deployments.

Jenkins is a great open-source automation server; Jenkins provides hundreds of plugins to support building, deploying, and automating any project. Here we are going to discuss the approach where Jenkins is used as a simple CI server and to automate the AWS Lambda invocation and deployment

We are leveraging a plugin that will help us to have the above use case achieved.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Flow Diagram:

Lambda

Prerequisites:

Follow the official documentation to have it installed: Jenkins running on EC2

Step by Step Guide:

Step 1: AWS Lambda plugin installation

  1. Search and install for AWS Lambda plugin in available plugins by clicking Manage Jenkins and Manage Plugins
    Lambda
    LambdaLambda

Step 2: IAM Set up

  1. For deployment and invocation, we need access to the GetFunction, CreateFunction, UpdateFunctionCode and UpdateFunctionConfiguration, InvokeFunction
  2. We need access to iam:PassRole to attach a role to the Lambda.
  3. Replace ACCOUNTID, FUNCTIONROLE accordingly in the policy. This Instance profile role with policy can be attached to the EC2 instance on which Jenkins is running.

Step 3: Jenkins Job Configuration

  1. Create a Maven project with Java source code repo details.
  2. Build and test code as per requirement
  3. In post-build steps add AWS Lamba deployment
  4. Configure required details like AWS Region, Function Name, Role, zip location (generated jar which is built). AWS keys are not required as we are using the Instance role
  5. We can also configure environment variables, subnets if we configure lambda within VPC. Please check Use Instance credentials to have instance role leveraged
  6. Done!!! Save and Build Job to have your lambda created

Conclusion:

By following the above process, you can have continuous deployment into our lambda functions wherever there is a code change with test cases and code quality checks.

For more DevOps, and CICD content, stay tuned to this page. If you have any queries about the CICD process, post them in the below comment section and I will get back to you at the earliest.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery PartnerAmazon CloudFront Service Delivery PartnerAmazon OpenSearch Service Delivery PartnerAWS DMS Service Delivery PartnerAWS Systems Manager Service Delivery PartnerAmazon RDS Service Delivery PartnerAWS CloudFormation Service Delivery PartnerAWS ConfigAmazon EMR and many more.

WRITTEN BY Chandan B

Chandan B works as a Project Head - DevOps & Kubernetes at CloudThat for the past five years. He is a multi-cloud certified DevOps professional, helping our clients to migrate, modernize and containerize their workload on the cloud by implementing standard DevOps best practices.

Share

Comments

  1. Pranay

    Jun 25, 2022

    Reply

    I need a declarative pipeline script to take the configuration files from bitbucket and replace the existing files in the lambda. Please guide

  2. Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!