A developer is creating an AWS Lambda function that generates a new file each time it runs. Each new file must be checked into an AWS CodeCommit repository hosted in the same AWS account. How should the developer accomplish this?
A.
When the Lambda function starts, use the Git CLI to clone the repository. Check the new file into the cloned repository and push the change.
B.
After the new file is created in Lambda, use cURL to invoke the CodeCommit API. Send the file to the repository.
C.
Use an AWS SDK to instantiate a CodeCommit client. Invoke the putjile method to add the file to the repository.
D.
Upload the new file to an Amazon S3 bucket. Create an AWS Step Function to accept S3 events. In the Step Function, add the new file to the repository.
C. Use an AWS SDK to instantiate a CodeCommit client. Invoke the putFile method to add the file to the repository is the best approach to accomplish the given task.
Agree. From Lambda function, we can use CodeCommit API to put new file(s) to a repository or a branch:
PutFile (API), which adds or modifies a single file in a specified repository and branch.
Ref: https://docs.aws.amazon.com/cli/latest/reference/codecommit/index.html
both A and C seems right. However, wrapping all your want inside lambda code is better than getting git configured during lambda runtime.
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/codecommit/AWSCodeCommitClient.html
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
jodeepak
Highly Voted 3 years, 8 months agoRachitNandi1997
Most Recent 1 year, 9 months agorcaliandro
1 year, 11 months agoRpod
2 years, 1 month agoMrTee
2 years, 1 month agoKrok
2 years, 2 months agopancman
2 years, 3 months agodark_cherrymon
2 years, 6 months agoLaXuanLinh
2 years, 9 months agoJP_PA
3 years, 4 months agorolymeck
3 years, 7 months agoaws_leo
2 years, 6 months agoVAG1595
3 years, 7 months agogobble
3 years, 7 months agoChinta
3 years, 7 months agoPopoAWS
3 years, 7 months agodragonie
3 years, 7 months agoBiswaGB
3 years, 8 months agoquanlh
3 years, 8 months ago