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
Flow Diagram:
Prerequisites:
Follow the official documentation to have it installed: Jenkins running on EC2
Step by Step Guide:
Step 1: AWS Lambda plugin installation
- Search and install for AWS Lambda plugin in available plugins by clicking Manage Jenkins and Manage Plugins
Step 2: IAM Set up
- For deployment and invocation, we need access to the GetFunction, CreateFunction, UpdateFunctionCode and UpdateFunctionConfiguration, InvokeFunction
- We need access to iam:PassRole to attach a role to the Lambda.
123456789101112131415161718192021222324252627282930{"Version": "2012-10-17","Statement": [{"Sid": "Stmt1432812345671","Effect": "Allow","Action": ["lambda:GetFunction","lambda:CreateFunction","lambda:UpdateFunctionCode","lambda:UpdateFunctionConfiguration","lambda:InvokeFunction"],"Resource": ["arn:aws:lambda:REGION:ACCOUNTID:function:FUNCTIONNAME"]},{"Sid": "Stmt14328112345672","Effect": "Allow","Action": ["iam:Passrole"],"Resource": ["arn:aws:iam::ACCOUNTID:role/FUNCTIONROLE"]}]}
- 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
- Create a Maven project with Java source code repo details.
- Build and test code as per requirement
- In post-build steps add AWS Lamba deployment
- 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
- We can also configure environment variables, subnets if we configure lambda within VPC. Please check Use Instance credentials to have instance role leveraged
- 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
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 Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner, AWS Config, Amazon 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.
Pranay
Jun 25, 2022
I need a declarative pipeline script to take the configuration files from bitbucket and replace the existing files in the lambda. Please guide