Edward Asquith
06/01/2022, 1:30 PM--trust
the build account and set IAM to allow the CI runner to assume these roles. All good so far.
However, when I set --role-arn
and --region
during SST deployment it still tries to deploy into the build account - which figures. So I tried setting the stack env
which in CDK allows me to specify the target account and region (which I can do based on stage name).
This fails thusly:
Error: Do not set the "env" prop while initializing "teams" stack ({"region":"eu-west-2","account":"<redacted>"}). Use the "AWS_PROFILE" environment variable and "--region" CLI option instead.
That looks like a different behaviour from stock CDK (I presume for some good reason).
Am I at a dead end? Could be that I’ve misunderstood the purpose of CDK bootstrapping as I’m trying to use it for the first time, but it makes it look like I have to use AWS_PROFILE in practice, rather than assuming a bootstrapped role in the target account.Edward Asquith
06/01/2022, 2:20 PMEdward Asquith
06/01/2022, 2:40 PM--role-arn
if specified?
edit: Tried this with plain cdk, and got similar results to SST. Merely setting the role-arn on the command line is not enough to tell it which account to deploy to.
Tends to suggest that I have misunderstood what is achievable with CDK v2 bootstrapping. Maybe I need to be in a profile with the target account - even with limited privileges - before I can use this. It’s frustrating, because the docs refer to “cross account deploys”Edward Asquith
06/02/2022, 2:53 PMFrank
Frank
Edward Asquith
06/03/2022, 7:41 PM