DVA-C02 Question 230
Select 2You are developing a serverless application using AWS Lambda and hosting the source code in a Git repository. You want to automate the deployment process so that every push to the main branch triggers the build and deployment of the Lambda function. Which combination of services would you use to achieve this?
- A
AWS CodePipeline and AWS CodeBuild
- B
AWS CodeDeploy and AWS Elastic Beanstalk
- C
AWS CodePipeline and Amazon S3
- D
AWS CodePipeline and AWS Lambda
- E
AWS CodeCommit and AWS CodePipeline
Show answer and explanation
Correct answers: A, D
Explanation
To automate the build and deployment of a Lambda function upon code changes in a Git repository, you can use AWS CodePipeline to orchestrate the CI/CD process and AWS CodeBuild to handle the build stage. AWS Lambda can then be set as the deployment target within the CodePipeline. This combination allows seamless automation of the deployment process for serverless applications.
- A. Correct.
Correct: AWS CodePipeline allows you to define a CI/CD pipeline, and AWS CodeBuild helps in building and packaging the application. Together, they automate the build and deployment process.
- B. Incorrect.
Incorrect: AWS CodeDeploy is used for deploying applications to services like EC2, Lambda, or on-premises, but AWS Elastic Beanstalk is not necessary for this serverless use case.
- C. Incorrect.
Incorrect: While Amazon S3 can be used to store artifacts, it is not sufficient to automate the entire build and deployment pipeline. It cannot trigger builds or deployments by itself.
- D. Correct.
Correct: AWS CodePipeline can orchestrate the CI/CD process, and AWS Lambda can be configured as the deployment target in the pipeline for a serverless application.
- E. Incorrect.
Incorrect: AWS CodeCommit is a Git-based repository service, but the question specifies the source code is already hosted in a Git repository. It is not needed in this scenario with the given requirements.