Questions tagged [aws-cdk]

The AWS CDK is an infrastructure modeling framework that allows you to define your cloud resources using an imperative programming interface.

The AWS CDK is an infrastructure modeling framework that allows you to define your cloud resources using an imperative programming interface, currently TypeScript/JavaScript, Python, Java, C# and (beta) Go.

Developers can use one of the supported programming languages to define reusable cloud components called Constructs, which are composed together into Stacks and Apps.

The AWS CDK Toolkit is a command-line tool for interacting with CDK apps. It allows developers to synthesize artifacts such as AWS CloudFormation Templates, deploy stacks to development AWS accounts and “diff” against a deployed stack to understand the impact of a code change.

The AWS Construct Library includes a module for each AWS service with constructs that offer rich APIs that encapsulate the details of how to use AWS. The AWS Construct Library aims to reduce the complexity and glue-logic required when integrating various AWS services to achieve your goals on AWS.

3488 questions
10
votes
1 answer

AWS CDK - Cannot use tokens in construct ID - How do I dynamically name constructs based off the names of other constructs?

I want to create the same CW alarm/metrics for a number of DynamoDB tables in cdk, my instinct was to try to use a for loop to append the name of the DDB table to the CW alarm, but doing so generates the following error: Cannot use tokens in…
Claudiu Moise
  • 376
  • 3
  • 14
10
votes
1 answer

How to skip IAM change confirmation during a cdk deploy?

When deploying any changes with the CDK that require IAM policy updates, you get the following message: This deployment will make potentially sensitive changes according to your current security approval level which is followed by the list of…
jaredready
  • 2,398
  • 4
  • 23
  • 50
10
votes
4 answers

How to deploy AWS CDK stacks to multiple accounts?

AWS CDK stacks target an account or region based on an evironment, details here. Here is an example of an app that deploys one stack into multiple target accounts: const envEU = { account: '2383838383', region: 'eu-west-1' }; const envUSA = {…
John
  • 10,837
  • 17
  • 78
  • 141
10
votes
3 answers

What are other CDK templates besides sample-app?

As I am learning the AWS CDK I have invoked 'cdk init' to create a new project with the default sample-app template. What are other templates and/or where are they located? $ cdk init --help cdk init [TEMPLATE] Create a new, empty CDK project…
Stevko
  • 4,345
  • 6
  • 39
  • 66
10
votes
3 answers

In AWS API Gateway, can I use a Usage Plan without attaching an API Key?

AWS documentation on API Gateway Usage Plans all imply that they're created with/attached to API Keys, but don't state how it will behave without one. I have an unauthorized API that I would like to apply throttling to. Can I create a Usage Plan,…
10
votes
3 answers

AWS CDK How to reference subnets just created using CDK

I'm trying to reference a couple of subnets to create ec2 instances but I'm sort of stuck. Let's say I have this: const vpc = new Vpc(this, 'gwc-vpc', { cidr: "10.20.0.0/16", maxAzs: 3, subnetConfiguration: [ { …
alf
  • 101
  • 1
  • 1
  • 3
10
votes
5 answers

How to fix 'command not found' for aws-cdk after running the npm install

I am trying to install the aws-cdk and in the terminal and I run the npm install -g aws-cdk. As stated here After npm runs, I get: /usr/local/Cellar/node/9.8.0/bin/cdk -> /usr/local/Cellar/node/9.8.0/lib/node_modules/aws-cdk/bin/cdk +…
T. Gerdy
  • 574
  • 1
  • 7
  • 13
9
votes
1 answer

How to deploy NextJS on AWS, the same way Vercel does?

I want to deploy NextJS on AWS using AWS CDK for a POC and was looking at options. In the NextJS docs, it says that we can just create an instance and run npm run build && npm start, it will start the service for us. However, this is not the most…
vighnesh153
  • 4,354
  • 2
  • 13
  • 27
9
votes
2 answers

AWS-CDK: Passing cross-stack references props between multi region (cross-region) stacks in AWS- CDK

I have to deploy one stack, let's call it the parent stack in one region Them a second stack(child) needs to be deployed, in another region. The region of the second stack(child stack) can not include the region where the parent was deployed. The…
9
votes
1 answer

What is the difference between @aws-cdk/pipelines and @aws-cdk/aws-codepipeline?

These two packages seem to largely do the same thing? What is the intended difference between these two packages and also which should I be using?
9
votes
4 answers

Get a list of stack dependencies using CDK cli

Is it somehow possible to get a list of the stacks that another stack depends on using the AWS CDK CLI? For example, given a list of stacks that looks something like: const app = new App(); const alphaStack = new Stack(app); const betaStack = new…
Micheal Hill
  • 1,619
  • 2
  • 17
  • 38
9
votes
2 answers

Shouldn't I git ignore cdk.out folder which is made by AWS CDK?

AWS CDK create cdk.out project root. I don't know if I should add git files.
Takato Horikoshi
  • 363
  • 5
  • 15
9
votes
2 answers

AWS CodeBuild tsc error TS2307: Cannot find module

I have created a couple different TypeScript cdk pipelines, and they all encounter the same tsc error during the CodeBuild phase. Two of these pipelines were replicated via the cdk…
Makuziker
  • 91
  • 1
  • 2
9
votes
3 answers

aws cdk to use non-default profile

I don't want to use my default aws profile and account for cdk development So I created a new account and a new profile cdkprof using aws configure --profile cdkprof . I have verified in ~/.aws/credentials and ~/.aws/config files that the new…
bearrider
  • 172
  • 2
  • 11
9
votes
3 answers

Which is the best way to create an ECR repository using CDK?

I'm using CDK for a while and I'm not sure yet which is the best way to launch a stack that create an ECR repository, building and sending a docker image to ECR. My last try was something like that: taskDefinition.addContainer("container", { …
Robson Andrade
  • 101
  • 1
  • 1
  • 5