question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make the CLI experience of multi-account CDK apps awesome

See original GitHub issue

After all of the issues/PRs for cross-account CodePipelines are delivered (#3208, #3323 , #3387, #3388, #3389 ), we will have a great story for making it very easy to work with cross-account CodePipelines.

However, we also need to make it easy to work with cross-account CDK apps from the perspective of authentication from the command line. Most likely, this will involve a deeper integration with AWS profiles defined in the ~/.aws/credentials / ~/.aws/config files. A possible solution would be to allow passing profile when creating a Stack:

new Stack(app, 'Stack1', {
  env: {
     profile: 'account1',
  },
});

The ideal customer experience we want here is to be able to say:

$ cdk deploy '*'

, and all of the different credentials for the different accounts the Stacks belong to will be automatically wired together.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:50
  • Comments:33 (13 by maintainers)

github_iconTop GitHub Comments

9reactions
eladbcommented, Sep 10, 2019

I am curious what people think about this idea which came up as part of the CI/Cd design: My current thinking is that when you bootstrap an environment using the cdk you will be able to specify a trusted account that will be able to deploy into this environment and then the cli will just assume a role in the target and deploy into it. No profiles needed…

8reactions
pcgeek86commented, Feb 9, 2020

It would be great if we could specify an IAM Role to assume in the Environment object.

Example

from aws_cdk.core import App, Environment
from awscdktest.awscdktest_stack import AwscdktestStack

env = Environment(region="us-west-2", assume_role='arn:aws:iam:us-west-2:000000000000:rolename')
app = App()
AwscdktestStack(app, "awscdktest", env=env)
app.synth()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy your CDK app to multiple environments - YouTube
AWS Hero Thorsten Hoeger shows us how to the use the new CDK Pipelines feature to setup multi account / multi region deploys....
Read more >
Bootstrapping multiple AWS accounts for AWS CDK using ...
You can bootstrap an AWS account by using the AWS CDK CLI and running cdk bootstrap . This is great for teams that...
Read more >
How to deploy AWS CDK stacks to multiple accounts?
Ideally, I'd like to be able to do a single command to deploy all stacks across all accounts: cdk deploy ... Or is...
Read more >
CDK Cross-Account Pipelines - AWS in Plain English
Cross account pipelines are a pretty common scenario, and recommended by AWS ... I'm using AWS CDK to develop and deploy infrastructure and...
Read more >
Hey CDK, how do cross-account deployments work?
The AWS CDK makes it easy to deploy your application, regardless if it consists of multiple stacks that are deployed in multiple accounts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found