Your team is looking into the Serverless deployment of an AWS lambda function.
The function will be deployed using the Serverless application model.
To test this out, you first create a sample function created below. var AWS = require('aws-sdk'); exports.handler = function(event, context, callback) { var bucketName = "Demobucket"; callback(null, bucketName); } What should be the next steps in the serverless deployment? Choose 2 answers from the options given below.
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - A and D.
This is given in the AWS Documentation.
Option B is incorrect since you need to package both the application function and the YAML file.
Option C is incorrect since you have the requirement to deploy this in an automated fashion.
Please refer to the below link, Step 3 and Step 4, for further details.
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-quick-start.htmlTo deploy a serverless AWS Lambda function using the Serverless Application Model (SAM), you need to follow the following steps:
Write the function code: The first step is to write the code for your Lambda function. In this case, a sample function is given in the question, which can be used to test the deployment process.
Create a SAM Template: Create a YAML file that defines the AWS resources that make up your serverless application, including the function, event sources, permissions, and any other resources you need. The SAM Template is the deployment specification that is used to deploy your serverless application.
Package the code and dependencies: Use the SAM CLI to package your Lambda function code and any dependencies into an Amazon S3 bucket. The package command will create a ZIP file of your code and dependencies and upload it to the S3 bucket you specify. The packaged code will be used by AWS Lambda to create a new version of your function.
Deploy the SAM Template: Use the SAM CLI to deploy your serverless application. This command creates and configures the AWS resources defined in the SAM Template. The deploy command will create or update the CloudFormation stack that represents your serverless application.
Test the function: Use the AWS Lambda console or the AWS CLI to test your Lambda function. You can pass in test events to see how your function responds.
Based on the above steps, the correct answers to the question are A and D.
A. Create a YAML file with the deployment specific's and package that along with the function file: This step is required to create the SAM Template, which defines the AWS resources that make up your serverless application, including the function, event sources, permissions, and any other resources you need. The packaged code and the YAML file are required to deploy the serverless application.
D. Upload the complete package onto an S3 bucket: This step is required to package the code and dependencies using the SAM CLI and upload the ZIP file to an S3 bucket. The packaged code will be used by AWS Lambda to create a new version of your function.