AWS Certified Developer - Associate Exam: Serverless Deployment with Lambda Functions

Serverless Deployment with Lambda Functions

Prev Question Next Question

Question

You have the following YAML file given to you which is required to deploy a Lambda function using serverless deployment. AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: TestFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs6.10 Environment: Variables: S3_BUCKET: demobucket Which of the following is required to ensure the deployment can take place? Please select 2 correct answers.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A and C.

The above snippet is used to create a serverless application that is deployed using the serverless deployment language.

You need to ensure that the Lambda function is present as part of the deployment package.

Option B is incorrect since these are not CloudFormation specific templates.

Option D is incorrect since this is normally used for Elastic Beanstalk deployments.

For more information on serverless deployment, please refer to the below URL-

https://docs.aws.amazon.com/lambda/latest/dg/serverless-deploy-wt.html

To ensure the deployment can take place for the given YAML file, you need to perform the following steps:

  1. Use the AWS CLI or AWS SDKs to package the deployment using the CloudFormation package command. This command will create a new CloudFormation template that includes the AWS Lambda function code, and all required dependencies.

  2. Use the CloudFormation deploy command to deploy the packaged CloudFormation template to AWS. This command will create a new CloudFormation stack that includes the Lambda function and its associated resources.

So, option A is correct as it suggests using the CloudFormation package command to package the deployment.

Option B is also correct as it suggests using the CloudFormation package command to deploy the template.

Option C is incorrect because the function code needs to be in a separate directory from the YAML file.

Option D is also incorrect as the .eb extensions folder is not relevant to AWS Lambda deployment using serverless deployment.