Deploy AWS Lambda on AWS S3 using Azure DevOps CI-CD

AWS lambda deployment on AWS S3 using azure devops

Once your AWS Lambda function is ready to deploy, you can choose many ways to deploy it on S3, I choose azure DevOps version control here to deploy it on S3.

aws lambda azure devops pipeline

The designed .yaml file is below on Ubuntu OS:

Note: Please set up your environment variables in Azure Library (AWS_Configuration_Variables) and defined them in the .yaml file.

# (see https://aka.ms/yaml for the YAML schema reference)

trigger:

branches:

include:

- main

paths:

include:

- /Migrations

pool:

vmImage: ‘ubuntu-latest’

variables:

- group: AWS_Configuration_Variables

steps:

- task: Bash@3

inputs:

targetType: ‘inline’

script: |

echo ‘Starting aws cli’

sudo apt install aws cli

aws — version

echo ‘configure aws cli’

export AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID)

export AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY)

export AWS_DEFAULT_REGION=$(AWS_DEFAULT_REGION)

echo ‘ — — — — — — -Zip the project folder — — — — — — -’

zip -r9 $(PROJECT_FOLDER)/snowfunc.zip .

echo ‘ — — — — — — — — — — -zip complete at ‘$(PROJECT_FOLDER)

aws s3 cp $(PROJECT_FOLDER)/snowfunc.zip s3://parts-data-blobs3/snowfunc.zip

echo ‘ — — — uploaded on AWS S3 — — — — — — — ‘

AWS lambda update-function-code — function-name snowfunc — region $(AWS_DEFAULT_REGION) — s3-bucket parts-data-blobs3 — s3-key snowfunc.zip

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

happy deployment 😊

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store