242 questions
1
vote
1
answer
1k
views
CDK's CodePipeline or CodeBuildStep are leaving an S3 bucket behind, is there a way of automatically removing it?
I'm creating a CloudFormation stack using CDK with code roughly like this:
export class PipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: PipelineStackProps) {
...
8
votes
1
answer
15k
views
AWS CDK Working with Existing DynamoDB and Streams
I'm migrating my cloud solution to cdk. I can see how to add a stream to a new DynamoDB in the constructor through the TableProps:
const newTable = new dynamodb.Table(this, 'new Table', {
tableName: ...
67
votes
7
answers
40k
views
What IAM permissions are needed to use CDK Deploy?
My team has a pipeline which runs under an execution IAM role. We want to deploy code to AWS through CloudFormation or the CDK.
In the past, we would upload some artifacts to S3 buckets before ...
46
votes
4
answers
73k
views
How to import existing VPC in aws cdk?
Hi I am working on aws cdk. I am trying to get existing non-default vpc. I tried below options.
vpc = ec2.Vpc.from_lookup(self, id = "VPC", vpc_id='vpcid', vpc_name='vpc-dev')
This results in below ...
18
votes
4
answers
33k
views
enabling CORS for AWS API gateway with the AWS CDK
I'm trying to build an application with the AWS CDK and if I were to build an application by hand using the AWS Console, I normally would enable CORS in API gateway.
Even though I can export the ...
6
votes
2
answers
3k
views
How to create AWS resources to run a CDK application locally using SAM?
I have an application called Example4Be, I have a stack that creates the AWS non-Lambda resources (just DynamoDB in this case, but could be SQS, SNS, etc):
import * as cdk from "aws-cdk-lib"
...
3
votes
2
answers
4k
views
AWS CDK, typescript - Argument of type 'this' is not assignable to parameter of type 'Construct'
I have this code generated by cdk cli(typecript-language):
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as appsync from '@aws-cdk/aws-appsync';
...
0
votes
1
answer
3k
views
AWS CDK API Gateway enable Cors
I am trying to enable Cors for AWS API Gateway using cdk and I seem to be doing everything correctly but the react front end still gives cors error. My cdk code looks like this. Pasting the same url ...
35
votes
5
answers
58k
views
How do I reference cross-stack resources in the same app?
I have an app that has two stacks, both within the same region/account. One of those stacks requires the ARN of a lambda that exists in the other stack. How do I reference this?
// within stackA ...
33
votes
10
answers
74k
views
How to solve CDK CLI version mismatch
I'm getting following error:
This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.
(Cloud assembly schema version mismatch: ...
30
votes
5
answers
33k
views
How to add a tag to an AWS-CDK construct
How to add a tag to an AWS-CDK specific construct or even better one tag definition to all ressources created within the stack?
26
votes
13
answers
63k
views
ModuleNotFoundError: No module named aws_cdk
When I run cdk deploy, I get the following error:
Traceback (most recent call last):
File "app.py", line 3, in <module>
from aws_cdk import core
ModuleNotFoundError: No module ...
24
votes
6
answers
53k
views
How to add S3 BucketPolicy with AWS CDK?
I wanna translate this CloudFormation piece into CDK:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: S3BucketImageUploadBuffer
PolicyDocument:
Version: "2012-10-17"
Statement:
...
20
votes
6
answers
15k
views
How to install dependencies of lambda functions upon cdk build with AWS CDK
When using AWS SAM I used to run build command which would go through all of my Lambda function packages and install their dependencies (run npm install on them).
How can I achieve the same behavior ...
18
votes
3
answers
36k
views
Resolving cyclical dependencies between AWS CDK CloudFormation stacks
Context, I have a CDK app with two stacks using the following setup:
Stack_A:
StateMachine_A
Lambda_A
S3Bucket_A
IAMRole_A
Stack_B:
StateMachine_B
SageMakerTrainJob_B
...