A developer is configuring a simple release pipeline in AWS CodePipeline. The pipeline has a source stage, a build stage using AWS CodeBuild, and a deployment stage using AWS CodeDeploy. The developer needs to pass the compiled build output from the build stage to the deployment stage.
How should the developer configure the pipeline to transfer these files between the stages?
- Define an output artifact in the build stage action, and reference it as an input artifact in the deployment stage action.Answer
- BStore the build output files in AWS Systems Manager Parameter Store during the build stage, and retrieve them during the deployment stage.
- CWrite the build output files to a temporary directory and configure the IAM trust policy of the build role to allow the deployment role to assume it and pull the files.
- DHardcode IAM user access keys in the build environment variables to write the build outputs directly to the deployment environment.
Answer
Define an output artifact in the build stage action, and reference it as an input artifact in the deployment stage action.
AWS CodePipeline manages the flow of data between stages through input and output artifacts. When a stage like CodeBuild runs, it can package its output into a ZIP file and upload it to the pipeline's S3 artifact bucket as an output artifact. Subsequent stages, such as CodeDeploy, can then download this ZIP file by referencing it as an input artifact.
Step-by-Step Solution
Key Concept
AWS CodePipeline uses input and output artifacts to share files between pipeline actions and stages.