How To Deploy NodeJs Code Using AWS Lambda & S3 Bucket In GitLab(Simple Explanation)

Publié le: 12 janvier 2024
sur la chaîne: Devops Zplus
1,144
23

Ref:
https://docs.aws.amazon.com/cli/lates...
https://docs.aws.amazon.com/cli/lates...

Please find below .gitlab-ci.yml file

stages:
make-zip-file
create-s3-bucket-and-upload-zip-file
create-lambda-function

image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest

variables:
my_bucket: nodejs-app-deploy-lambda092

make-zip-file:
stage: make-zip-file
script:
echo "make zip"
mkdir bin/
zip -r9 node-js-app.zip index.js
cp node-js-app.zip bin/
ls
artifacts:
paths:
bin/

create-s3-bucket-and-upload-zip-file:
stage: create-s3-bucket-and-upload-zip-file
script:
aws s3 mb s3://$my_bucket
aws s3 ls
ls bin/
cd bin/
aws s3 cp node-js-app.zip s3://$my_bucket
needs:
job: make-zip-file
artifacts: true

create-lambda-function:
stage: create-lambda-function
script:
echo “Create lambda function”
echo $my_bucket
aws lambda create-function --function-name node-app --runtime nodejs20.x --handler index.handler --role arn:aws:iam::1845983:role/lambda --code S3Bucket=$my_bucket,S3Key=node-js-app.zip


Sur cette page du site, vous pouvez voir la vidéo en ligne How To Deploy NodeJs Code Using AWS Lambda & S3 Bucket In GitLab(Simple Explanation) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Devops Zplus 12 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,144 fois et il a aimé 23 téléspectateurs. Bon visionnage!