Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws-codepipeline-actions): Support cross-account ECS deployments with codepipeline actions #17558

Closed
kartickvijayakumar opened this issue Nov 18, 2021 · 8 comments
Assignees
Labels
@aws-cdk/aws-codepipeline-actions closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@kartickvijayakumar
Copy link

General Issue

Cross Account & Cross Region ECS

The Question

What is the recommended approach from CDK for cross account ECS deployments through codepipeline at present?

We have a code pipeline that needs to deploy a fargate service into multiple AWS accounts and regions.

The few things we considered were:

  1. Multi-stack approach where we have a pipeline stack with a CodeBuildAction that builds the actual service, pushes the container image to ECR and outputs an imageTag. Another CodeBuildAction does a cdk synth for the service stack and outputs its template. We then use TagParameterContainerImage with a CloudFormationCreateUpdateStackAction to deploy this template with the appropriate imageTag - An ECR resource policy issue described in (aws-codepipeline-actions): TagParameterContainerImage unusable cross-account #15070 blocks this approach to do this cross-account.
  2. Single stack with multiple stages in a code-pipeline with instances of EcsDeployAction that takes account and region as parameters and a `role' with appropriate cross-account and cross-region permissions - Something similar to this has been discussed in [aws-codepipeline-actions] support cross account/region ecs deployment  #11199 but the issue has been closed with a pull request (fix(ecs): imported services don't have account & region set correctly #15944) without clarity on the final approach.

Is there any elegant way of doing this today? Probably @skinny85 who has been active in most of these issues and discussions can help us with this.

CDK CLI Version

1.132.0

Framework Version

No response

Node.js Version

No response

OS

No response

Language

Typescript

Language Version

No response

Other information

No response

@kartickvijayakumar kartickvijayakumar added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Nov 18, 2021
@skinny85
Copy link
Contributor

skinny85 commented Nov 19, 2021

Hey @kartickvijayakumar,

the recommended CDK-team solution is to use the CDK Pipelines module for these cross-account deployments.

CDK Pipelines handles Assets for you, automatically.

Thanks,
Adam

@skinny85 skinny85 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 19, 2021
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Nov 21, 2021
@ryparker ryparker removed the needs-triage This issue or PR still needs to be triaged. label Nov 23, 2021
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 26, 2021
@trefore-iakbar
Copy link

trefore-iakbar commented Nov 27, 2021

@skinny85 Is there any sample code on how to use the CDK Pipelines module to do this?

@stockf
Copy link

stockf commented Dec 13, 2021

I'm also interested in how exactly you would do this with @aws-cdk/pipelines. I've tried to solve this for a while now and it is really tricky. I endet up with an additional S3 source with my image tag that I want to deploy and a context-variable for the tag that I overwrite in the build phase.

@skinny85
Copy link
Contributor

@stockf there's a pretty detailed explanation on how to achieve this by @tobytipton in #17917 (comment).

@stockf
Copy link

stockf commented Dec 15, 2021

@skinny85 thank you for the reference. Maybe I missed something. But as far as I can see @tobytipton does not use the @aws-cdk/pipelines module at all.

@tobytipton
Copy link
Contributor

I added an examples as part of a PR #18042 adding test cases to show how the ECS deploy can work similar to my non-CDK pipeline example in #17917.

@stockf
Copy link

stockf commented Jan 10, 2022

Thx @tobytipton that is a helpful example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline-actions closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants