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
7
votes
1 answer

How to make a S3 deployment with the modern version of CodePipeline

I am trying to setup a brand new pipeline with the last version of AWS CDK for typescript (1.128). The creation of the pipeline is pretty straight forward. I have added sources and build stages with no issues. The objective here is to have an…
7
votes
1 answer

How to solve : "Received response status [FAILED] from custom resource. Message returned: Resource is not in the state certificateValidated"? CDK

I have the following error trying to create a static website inspired by https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/static-site/static-site.ts const certificateArn = new acm.DnsValidatedCertificate( this, …
Jorge Tovar
  • 1,374
  • 12
  • 17
7
votes
1 answer

Avoiding a race condition in cdk bootstrap - concurrent runs of test and deploy pipeline

I have a production upgrade test pipeline that is run on every PR that will deploy a copy of production to a test account and then upgrade that with what's on the feature branch. This is done to ensure that the production upgrade is always…
7
votes
1 answer

aws cdk push image to ecr

I am trying to do something that seems fairly logical and straight forward. I am using the AWS CDK to provision an ecr repo: repository = ecr.Repository( self, id="Repo", …
Ben Muller
  • 221
  • 1
  • 4
  • 10
7
votes
1 answer

Add existing dynamodb table with stream to CDK

I currently have a dynamodb table that's been in use for a couple of years, originally created in the console. It contains lots of valuable data. It uses a stream to periodically send a snapshot using a lambda trigger of the table to s3 for…
monkey
  • 1,213
  • 2
  • 13
  • 35
7
votes
1 answer

Assigning Different Lambda Functions to Stages in AWS CDK Stack

I am working on a cdk deploy script and I have it somewhat working but am lost/not having luck setting the different stages and applying different lambdas to the api resources. So I have // Construct lambdas - prod const lambdaBacklogGet =…
Tim B
  • 215
  • 1
  • 2
  • 12
7
votes
2 answers

CDK pipeline for multiple branches at the same time

I would like to have the CI-CD pipeline deployed for the develop and master branch at all times. Pipeline for feature branches to be created manually developers as and when needed. I am using the pipeline from…
systemdebt
  • 4,589
  • 10
  • 55
  • 116
7
votes
1 answer

How to do database schema migrations as part of AWS CDK deploy?

We are running a web application on AWS EC2 that connects to a MariaDB running on AWS RDS. We have AWS CDK scripts set up for creating a new infrastructure including everything from our own services (the web application itself, background workers,…
7
votes
1 answer

How to create a Parameter Store entry without a value in AWS CDK?

In AWS CDK, you can create a parameter store entry for storing secrets like passwords. However you cannot leave the value blank, and you shouldn't put the secret in the CDK git repository, so how do you get the entry created? I am currently doing…
Malvineous
  • 25,144
  • 16
  • 116
  • 151
7
votes
2 answers

CDK create resource if does not exist - typescript

Created a dynamoDB table in my CDK project. this is fine it is used by lambdas created in the project. We needed to delete the stack which is also fine as we have retain resource set to true on the table. Now when I try a fresh deploy we get table…
AnonymousAlias
  • 1,149
  • 2
  • 27
  • 68
7
votes
2 answers

How to use an existing stage in API Gateway deployments in AWS CDK?

I have an existing API Gateway with resources and stages. I'm adding a new resource to it via aws cdk. The Gateway is configured with deploy:false, so I have to manually create a new deployment for it. I can import the gateway, but I can't find a…
7
votes
1 answer

create custom AWS IAM policy using CDK

As per doc : https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Policy.html I could create my own policy and attach to role but it is not creating a new policy rather attached as inline policy to the role. I want to create a custom…
logan
  • 7,946
  • 36
  • 114
  • 185
7
votes
6 answers

AWS CDK cross-stack references and deployment order

What's the way to overcome the circular dependency problem in AWS CDK: Let's imagine I have a stack for ECS cluster and a stack for ECS Service (several of them): export class EcsClusterStack extends cdk.Stack { public readonly cluster:…
Dzmitry Martavoi
  • 6,867
  • 6
  • 38
  • 59
7
votes
1 answer

How to perform database schema migrations after deploying with AWS CDK?

I'm running an Aurora PostgreSQL (Serverless) cluster. After I deploy the infrastructure for the first time, and every time I re-deploy, I want to run database schema migrations (add tables, add columns). How can I accomplish this? Lambda is out of…
moltar
  • 1,372
  • 1
  • 11
  • 18
7
votes
1 answer

Cross Account SNS Lambda Subscription using CDK

I have 2 AWS CDK applications running in separate AWS accounts, and I'm trying to add CDK to get a lambda in one AWS account to subscribe to notifications in the other AWS account. I tried adding the subscription in the lambda account, but this…
fileyfood500
  • 1,199
  • 1
  • 13
  • 29