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...

How to setup AWS CDK app execution in AWS CodeBuild?

I want to run AWS CDK synthesis from Git repository using AWS CodeBuild - i.e. if I update the CDK app code in the repo I want CloudFormation stacks to be updated automatically. What are the best...

aws-cdk Associate Lambda Function with CloudFront Web Distribution

I'm trying to create a CloudFront Web Distribution using aws-cdk. I'm able to successfully create the web distribution but I haven't been able to figure out how to associate a lambda function...

How do I nest a KeyValue pair within AWS CDK PolicyStatement AddAction method?

I am currently trying to replicate another developer's powershell script functionality using the AWS CDK with a .NET application. He is generating a CloudFormation template (YAML) using...

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...

AutoScalingGroup / BlockDevice

we are merging our CloudFormation Templates to aws-cdk. Creating AutoScalingGroup seems to be rather easy. But now I cann`t find how to configure the BlockDeviceMappings known from cloudformation....

How to deploy a CloudFormation stack using CodePipeline when both, the cfn template and the pipeline where created using the AWS CDK?

Using the AWS CDK I created a simple stack with an auto scaling group, and also define launch configuration resource to execute some powershell scripts during the ec2 instance creation. The...

CDK DnsValidatedCertificate: Can create a certificate in a linked AWS account, when the hosted zone is part of the parent account?

I'm trying to use AWS' Cloud Development Kit to create an SSL certificate for some sub-subdomains of my website. The trouble is that I'm using AWS Organizations and the relavant resources belong...

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 cloud formation template. I would like to add parameters to my CDK...

AWS CDK custom resource backed by a Lambda Function

CloudFormation itslef supports custom resources backed by lambda or ec2. However, i could not find something similar on AWS CDK. The only way it seems you can define custom resources is now by...

Is it possible to deploy AWS CDK stacks from within a Lambda?

I want to deploy AWS CDK stacks from with a Lambda function. The use case is to support similar functionality to that described in Trek10's Serverless CI/CD pipeline, where the relevant code is...

Does CDK perform orchestration ? apart from provisioning

We used CloudFormation/Terraform for provisioning resources in AWS. Provisioning is about creating a new state or transforming one state to another. for example: a state is a machine installed...

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 ...

How to set Instance.MachineImage from CfnMapping.FindInMap("MappingName", Aws.REGION)?

Using latest .NET CDK, I am trying to create a stack where Instance AMI is specified at deploy time depending on the region where stack is deployed. With regular CloudFormation I could do that...

How can I create a DependsOn relation between EC2 and RDS using aws-cdk

I am currently using the aws-cdk (typescript) to create a stack that consists of a EC2 instance and a RDS databaseInstance. The RDS instance needs to be setup before the EC2 instance can be...

AWS CDK VS SDK for IaC

I recently started working with AWS and IaC, I'm using Cloudformation to provision my AWS resources, but I discovered that AWS provide both a SDK and a CDK to enable you to provision resources...

Cannot assume role by code pipeline on code pipeline action AWS CDK

I have been playing with AWS CDK and was working on building a code pipeline stack on my AWS educate account. The user that I am using has enough permission to access and use the code pipeline. My...

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...

How to use a CfnParameter in AWS CDK without filling in the value at runtime

I have been attempting to use the AWS CDK to programmatically build a CloudFormation stack template, but am having trouble with using CfnParameters to parameterize the template. When I write a...

The value supplied for parameter 'instanceProfileName' is not valid

Running cdk deploy I receive the following error message: CREATE_FAILED | AWS::ImageBuilder::InfrastructureConfiguration | TestInfrastructureConfiguration The value supplied for parameter...

VPN Using AWS CDK

I've been working on creating a VPN using AWS's CDK. I had to use Cloudformation lower level resources, as there doesn't seem to be any constructs yet. I believe I have the code set up correctly,...

AWS Cloudformation - Stack vs NestedStack

I thought that this would be answered quite clearly out there on the internet. But I have found no sufficient answer to when to use one type of stacks and when to use another type of stacks. *So...

AWS cdk deploy --all fails to create ECS service

new to the CDK and relatively new to AWS The Issue I'm following this tutorial which includes creating a fargate based private API, and accessing it on the public internet through an ec2 instance...

How to upgrade CDK bootstrapping?

I have an environment which is already bootstrapped, and bootstrapping again (with CDK 1.106.1) doesn't seem to do anything: $ cdk bootstrap...

AssetParameters changes when CDK codes updates for EKS deployed

CDK is used to deploy EKS in our company. A co-worker created a EKS cluster with CDK and then I pulled the CDK codes, modified something. Before deployment, I ran 'cdk diff' command and the result...

export CDK to cloudformation template -python

I built a successful python CDK stack and i want to export it as cloudformation template , can someone guide me on that ? i found the below but it's not in python...

CDK deploy results in "Bucket named 'x' exists, but not in account 067685711111. Wrong account?

I am modifying a CDK pipeline that works. I am adding a lambda, and when this code modification is made, the pipeline fails with an error. import * as cdk from '@aws-cdk/core'; import * as lambda...

Default credentials can not be used to assume new style deployment roles

Following pipelines readme to set up a deployment pipeline, I ran $ env CDK_NEW_BOOTSTRAP=1 npx cdk bootstrap \ --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess...

AWS CDK StateMachine BatchSubmitJob with dynamic environment variables

I'm trying to create a statemachine with a BatchSubmitJob in AWS CDK with dynamic environment variables in the BatchContainerOverrides. I was thinking about something like...

What causes cdk bootstrap to hang?

I am trying to use the cdk bootstrap command. >$env:CDK_NEW_BOOTSTRAP=1 >npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess...