A developer is configuring a custom stage action in AWS CodePipeline that invokes an AWS Lambda function to perform integration testing. Arrange the following events in the correct chronological order, from the moment the Lambda action is initiated by the pipeline to the transition of the pipeline to the next stage.
- 1CodePipeline transitions the Lambda action to In Progress and generates a unique Job ID containing the credentials and parameters.
- 2CodePipeline invokes the specified Lambda function asynchronously, passing a JSON event payload containing the Job ID.
- 3The Lambda function executes its custom testing logic and parses the input event to retrieve the Job ID.
- 4The Lambda function calls the PutJobSuccessResult API operation using the AWS SDK, passing the retrieved Job ID.
- 5CodePipeline receives the success result, transitions the action status to Succeeded, and allows the pipeline to progress.
Answer
The correct order starts with CodePipeline transitioning the action to In Progress and generating a Job ID, followed by CodePipeline invoking the Lambda function with the payload. Next, the Lambda function executes and retrieves the Job ID, then calls PutJobSuccessResult with the Job ID, and finally, CodePipeline receives the result and transitions the action status to Succeeded.
The correct chronological order starts with CodePipeline generating the Job ID and transitioning the action to In Progress. Next, CodePipeline invokes the Lambda function, passing the Job ID in the event payload. The Lambda function then runs its code, retrieves the Job ID from the event payload, and finishes its tasks. Finally, the function calls the PutJobSuccessResult API with the Job ID, allowing CodePipeline to mark the action as Succeeded and proceed.
Step-by-Step Solution
Key Concept
AWS CodePipeline integration with AWS Lambda requires the Lambda function to explicitly return a success or failure status by calling the PutJobSuccessResult or PutJobFailureResult API operation using the Job ID provided in the invocation event payload.