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

Veröffentlicht am: 12 Januar 2024
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video How To Deploy NodeJs Code Using AWS Lambda & S3 Bucket In GitLab(Simple Explanation) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Devops Zplus 12 Januar 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,144 Mal angesehen und es wurde von 23 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!