Articles → AWS → Deploy The Lambda Function Using The AWS CLI
Deploy The Lambda Function Using The AWS CLI
Create A Lambda Function
Click to Enlarge
Create A S3 Bucket
Click to Enlarge
Sample Node.Js Code
exports.handler = async (event) => {
console.log(event);
return 'This is the updated code!';
};
Upload Code On S3 Bucket
Click to Enlarge
Configure CLI And Deploy Code Using CLI
aws lambda update-function-code --function-name myfunc --s3-bucket gyansangrah-bucket --s3-key myCode.zip –publish
- myfunc is the lambda function name
- gyansangrah-bucket is the S3 bucket name
- myCode.zip is the code file key uploaded on the S3 bucket
Click to Enlarge
Output
Click to Enlarge