A developer is configuring a cross-account continuous delivery pipeline in AWS CodePipeline. The pipeline resides in Account A and must deploy an application to Account B. The pipeline uses an Amazon S3 bucket in Account A to store deployable artifacts, which must be encrypted using a customer managed key in AWS KMS. Arrange the steps in the correct sequence to configure the cross-account pipeline and its security components so that the deploy action in Account B can successfully access and decrypt the artifacts.
- 1In Account A, create a customer managed KMS key and configure its key policy to grant the Account B root principal access to perform cryptographic operations.
- 2In Account B, create an IAM deployment role with a trust policy that allows the Account A pipeline execution role to assume it, and attach an inline policy allowing KMS decryption and resource deployment.
- 3In Account A, update the S3 artifact bucket policy to grant the ARN of the Account B deployment role permissions to perform s3:Get* and s3:Put* operations.
- 4In Account A, edit the pipeline JSON definition to configure the artifact store with the KMS key ID and set the roleArn of the deploy action to the Account B deployment role ARN, then update the pipeline using the AWS CLI.
Answer
The correct sequence of steps to configure the cross-account pipeline is: first, create the customer managed KMS key in Account A; second, create the IAM deployment role in Account B; third, update the S3 artifact bucket policy in Account A to grant access to the Account B role; and finally, update the pipeline JSON definition in Account A to reference these resources.
The correct sequence begins with creating the KMS key in Account A to establish cross-account encryption permissions. Next, the IAM deployment role must be created in Account B so that its ARN exists. With the role created, the S3 bucket policy in Account A can then be updated to reference the role's ARN without causing validation errors. Finally, the pipeline definition is updated to tie the KMS key and the deployment role ARN into the pipeline configuration.
Step-by-Step Solution
Key Concept
Cross-account AWS CodePipeline deployments require a specific ordering of resource creation because IAM role ARNs are validated during the saving of resource-based policies (like S3 bucket policies), and customer managed KMS keys are required for cross-account artifact encryption.