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
13
votes
2 answers

AWS CDK Init for an existing project

I'm trying to initialize the AWS CDK on a new website I just created via Visual Studio. But when I run the init commmand I get the error: cdk init cannot be run in a non-empty directory ❯ cdk init app --language=csharp `cdk init` cannot be run in a…
Philip Pittle
  • 11,821
  • 8
  • 59
  • 123
13
votes
3 answers

Cloudfront give Access denied response created through AWS CDK Python for S3 bucket origin without public Access

Created Cloud Front web distribution with AWS CDK for S3 bucket without public access. Able to create Origin access identity, and deploy but on successful deploy i get access denied response on browser. Grant Read Permissions on Bucket from Origin…
13
votes
1 answer

determine required permissions for AWS CDK

I'm working with AWS CDK and every time I go to create a new resource (CodePipeline, VPC, etc) I end up in the same loop of... try to deploy "you are not authorized to foo:CreateBar" update IAM permissions try to deploy "you are not authorized to…
Donald P
  • 823
  • 6
  • 22
13
votes
2 answers

Local development with the aws-cdk

Is it possible to deploy to localstack with the aws-cdk? Thought about switching from serverless to the cdk, but could not find any ohter local testing option except aws SAM..
VinceVega
  • 133
  • 1
  • 5
13
votes
2 answers

How to create VPC that can be shared across stacks?

I am trying to wrap my head around how to create a reusable VPC that can be used across multiple stacks using AWS CDK. I want to be able to create different stack per project and then be able to import the VPC that should be assigned to the…
alkesos
  • 335
  • 2
  • 8
13
votes
2 answers

CDK - How to get stack name in construct

I wrote a stack in CDK, then I'm generating the template and deploying it through aws cloudformation deploy --template-file "$env:TEMP\template.json" --stack-name myStackName Inside my Stack object, how can I retrieve the "myStackName" passed above…
Ariel
  • 5,752
  • 5
  • 49
  • 59
13
votes
6 answers

AWS CDK: how to target API Gateway API from Route53

I have an existing domain name registered with AWS Route53 and I have set up a custom domain name in API Gateway. In the console i can configure things such that xxxxxx.zenxxxxxxfoundry.com from the outside, actually reaches the API Gateway API and…
Michael Coxon
  • 3,337
  • 8
  • 46
  • 68
13
votes
4 answers

How to Import Security group from another stack using #AWS-CDK?

I would like to know how to import security group defined in another stack, and then use in current stack. I have tried this so far.. class relayStack extends cdk.Stack { public sg_relay: ec2.SecurityGroupRefProps constructor(parent:…
Rumman Ahmed
  • 189
  • 1
  • 1
  • 11
12
votes
3 answers

Is there a way of running AWS Step Functions locally when defined by CDK?

AWS Step Functions may be run in a local Docker environment using Step Functions Local Docker. However, the step functions need to be defined using the JSON-based Amazon States Language. This is not at all convenient if your AWS infrastructure (Step…
John
  • 10,837
  • 17
  • 78
  • 141
12
votes
1 answer

Resolution error: Cannot use resource 'x' in a cross-environment fashion, the resource's physical name must be explicit set

I'm trying to pass an ecs cluster from one stack to another stack. I get this error: Error: Resolution error: Resolution error: Resolution error: Cannot use resource 'BackendAPIStack/BackendAPICluster' in a cross-environment fashion, the resource's…
jeznag
  • 4,183
  • 7
  • 35
  • 53
12
votes
1 answer

How to solve circular dependency between AWS resources using AWS CDK

I am creating S3, SQS, and KMS resources using aws cdk. I enabled encryption on the S3 and SQS resources. When I enabled the notification from S3 to SQS, I am getting a circular dependency error. When I remove the KMS settings from my code, it…
Sachin Suresh
  • 121
  • 1
  • 6
12
votes
1 answer

CDK deployment API Gateway - CloudWatch Logs role ARN must be set in account settings to enable logging

If you're getting the following error when you're trying to deploy an API Gateway (in particular the Stage), you'll need to ensure you have a CloudWatch ern set up against your Account. Blah_V1Stage (V1Stage) CloudWatch Logs role ARN must be set in…
Gul Akbar
  • 121
  • 1
  • 3
12
votes
3 answers

What is the best way to do CI/CD with AWS CDK (python) using GitLab CI?

I am using AWS CDK (with Python) for a containerized application that runs on Fargate. I would like to run cdk deploy in a GitLab CI process and pass the git tag as an environment variable that replaces the container running in Fargate. I am…
12
votes
2 answers

How to specify parameter definition in CDK stack?

Use an AWS CloudFormation Parameter section of AWS CDK mentions how to customize your AWS CloudFormation templates. It refers to CloudFormation template. I would like to add parameters to my CDK stack and get the parameters section of the…
zdenko.s
  • 931
  • 1
  • 12
  • 29
11
votes
3 answers

Argument of type 'App' is not assignable to parameter of type 'Construct'

I am trying simple CDK tutorial, however I bumped into some error. My code is simply like this, Argument of type 'App' is not assignable to parameter of type 'Construct'. Type 'App' is missing the following properties from type 'Construct':…
whitebear
  • 11,200
  • 24
  • 114
  • 237