I have gone through everything you shared on a brand new account with no prior activity.
My setup includes AWS CDK version: 1.70.0 (the latest update as of 2020/10/28)
- To resolve this, make sure to include
"@aws-cdk/core:newStyleStackSynthesis": "true"
in the cdk.json
- Execute
cdk bootstrap --toolkit-stack-name custom-cdktoolkit
based on your previous instructions.
cdk bootstrap --toolkit-stack-name custom-cdktoolkit
'@aws-cdk/core:newStyleStackSynthesis' context is set for new-style bootstrapping
⏳ Bootstrapping environment aws://xxxxxx/us-east-1...
❌ Environment aws://xxxxxx/us-east-1 encountered bootstrapping failure: Error: Please pass '--cloudformation-execution-policies' to specify deployment permissions. Try using a managed policy 'arn:aws:iam::aws:policy/<PolicyName>'.
However, I faced issues while attempting to reproduce the error on my end.
Since more specific details are lacking, the subsequent steps are open-ended.
- Include the necessary cf-execution-policies:
cdk bootstrap \
--toolkit-stack-name custom-cdktoolkit \
--cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
'@aws-cdk/core:newStyleStackSynthesis' context set for new-style bootstrapping
⏳ Bootstrapping environment aws://xxxxx/us-east-1...
Trusted accounts: (none)
Execution policies: arn:aws:iam::aws:policy/AdministratorAccess
custom-cdktoolkit: proposing CloudFormation changes...
[██████████████████████████████████████████████████████████] (11/11)
✅ Environment aws://xxxxx/us-east-1 has been successfully bootstrapped.
- Let's examine an example stack (without any cross-account access) quickly:
// file: lib/cdk-playground-stack.ts
import * as cdk from "@aws-cdk/core";
import * as s3 from "@aws-cdk/aws-s3";
export class CdkPlaygroundStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new s3.Bucket(this, "id", {
accessControl: s3.BucketAccessControl.PRIVATE,
encryption: s3.BucketEncryption.S3_MANAGED,
versioned: false,
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
});
}
}
// file: app/app.ts
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from '@aws-cdk/core';
import { CdkPlaygroundStack } from '../lib/cdk-playground-stack';
const app = new cdk.App();
// no cross-account environment arguments (like account) passed to the stack!
new CdkPlaygroundStack(app, 'CdkPlaygroundStack');
- Deploy the stack using the provided command (due to the non-default cdk-bootstrap-name)
cdk deploy --toolkit-stack-name custom-cdktoolkit
CdkPlaygroundStack: deploying...
[0%] start: Publishing dbfc18c149132627081b768fbbfc4bc345aeba4259514174fcd302d8b3926a90:current_account-current_region
[100%] success: Published dbfc18c149132627081b768fbbfc4bc345aeba4259514174fcd302d8b3926a90:current_account-current_region
CdkPlaygroundStack: creating CloudFormation changeset...
[██████████████████████████████████████████████████████████] (3/3)
✅ CdkPlaygroundStack
Stack ARN:
arn:aws:cloudformation:us-east-1:xxxxxxx:stack/CdkPlaygroundStack/9b8d4460-1940-11eb-abd9-0e794c84352f
There seem to be no conflicts, and it's challenging to troubleshoot given the limited information provided.
Here are a few suggestions:
- Update to the latest CDK version
- Verify your Stack creation process and ensure no additional arguments/props are being passed concerning alternate accounts as specified in your AWS profile/environment variables. Cross-Account deployments require specific setup, hence the inquiry.
- Delete the bootstrapped CloudFormation stack
- Revisit the steps taken for accurate replication