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

Adding entry to route table with CDK (typescript) when its private subnet already exists

Is it possible to add an entry to an imported private subnet's route table with CDK in typescript? I'm importing the VPC with: import ec2 = require('@aws-cdk/aws-ec2'); vpc = ec2.Vpc.fromVpcAttributes(...) (docs on fromVpcAttributes:…
dmarch17
  • 83
  • 1
  • 4
8
votes
2 answers

Invalid AttributeDataType input, consider using the provided AttributeDataType enum

I am trying to create aws cognito user pool using aws cdk. below is my code - user_pool = _cognito.UserPool( stack, id="user-pool-id", user_pool_name="temp-user-pool", self_sign_up_enabled=True, sign_in_aliases={ …
Nitesh
  • 1,477
  • 5
  • 23
  • 34
8
votes
1 answer

Add Lambda trigger to imported Cognito User Pool with AWS CDK

I'm trying to use AWS CDK to create a new lambda tied to already existing AWS resources which were not created using CDK and that are part of a different stack. Can I trigger my lambda from an already existing user pool using CDK? I've imported the…
8
votes
5 answers

AWS CDK: run external build command in CDK sequence?

Is it possible to run an external build command as part of a CDK stack sequence? Intention: 1) create a rest API, 2) write rest URL to config file, 3) build and deploy a React app: import apigateway = require('@aws-cdk/aws-apigateway'); import cdk =…
8
votes
3 answers

AWS CDK: Unexpected token '?'

When I upgraded from 1.33.0 -> 1.37.0, I started getting the error below. I reverted back to the old CDK version, and the command works again. CDK version $ cdk --version 1.37.0 (build e4709de) Error: $ cdk synth Unexpected token '?' Subprocess…
Leon Hsu
  • 121
  • 1
  • 4
8
votes
4 answers

How to fetch SSM Parameters from two different accounts using AWS CDK

I have a scenario where I'm using CodePipeline to deploy my cdk project from a tools account to several environment accounts. The way my pipeline is deploying is by running cdk deploy from within a CodeBuild job. My team has decided to use SSM…
Pedreiro
  • 1,641
  • 2
  • 18
  • 28
8
votes
3 answers

What's the best way to consume Parameter Store value in AWS CDK

I am having problems using SSM valueForStringParameter method in CDK. It's working the first time I deploy the stack, but it is not picking up updates to the parameter value when I redeploy the stack because CloudFormation template hasn't changed…
Tofig Hasanov
  • 3,303
  • 10
  • 51
  • 81
8
votes
2 answers

How do we do Unit testing for AWS CDK code? And should we?

Based on the examples I see, the code assertions are expected json cf template versus the cdk synth generated template. How do we setup expected json cf template? If we manually create it, that defeats the purpose of using cdk. If we just copy…
froi
  • 7,268
  • 5
  • 40
  • 78
8
votes
3 answers

Is it possible to deploy a previously aws-cdk synthesized stack?

The aws-cdk allows you to synthesize a stack - which produces a number of files - including a .template.json file. Can this .template.json file be deployed without the aws-cdk tool? Or is it designed to require deployment via the aws-cdk tool? The…
Mark Taylor
  • 471
  • 4
  • 11
8
votes
2 answers

How to run Lambda created in CDK on a regular basis?

As the title says - I've created a Lambda in the Python CDK and I'd like to know how to trigger it on a regular basis (e.g. once per day). I'm sure it's possible, but I'm new to the CDK and I'm struggling to find my way around the documentation.…
Jamie
  • 1,530
  • 1
  • 19
  • 35
8
votes
1 answer

How to add an Internet Gateway to a VPC using AWS CDK?

I am trying to produce the correct CDK scripts (TypeScript) to create an environment with a Lambda (accessed via API Gateway) that can call an RDS (Sql Server instance). I believe I have it mostly working, but I wanted to connect to the RDS instance…
shenku
  • 11,969
  • 12
  • 64
  • 118
8
votes
1 answer

How to add Metadata to IAM Policy using AWS CDK?

I'm need to add some Metadata into Cloudformation for a IAM Policy. How can I do this with CDK ? I'm using the CDK to synth a cloudformation and I need to include a metadata to suppress cfn-nag (https://github.com/stelligent/cfn_nag) warnings. I did…
8
votes
1 answer

Hash in the Logical Id of the resources in CDK/Cloudformation

Whenever I generate cloudformation template from CDK, I see that in logical ids, it adds some kind of Hash. What does that Hash mean? Eg. Test4FCEEF4A How does this Hash 4FCEEF4A gets generated?
hatellla
  • 4,796
  • 8
  • 49
  • 101
8
votes
3 answers

Convert CloudFormation template (YAML) to Troposphere code

I have a large sized CloudFormation template written in Yaml, I want to start using Troposphere instead. Is there any easy way to convert the CF template to Troposphere code? I have noticed this script here…
Sam Anthony
  • 1,669
  • 2
  • 22
  • 39
7
votes
3 answers

How to get rid of the BootstrapVersion parameter with cdk synth?

When generating the cloudformation template with aws cdk: cdk synth I always get: "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", ... Here the code: import * as cdk from 'aws-cdk-lib'; import {…
Felix
  • 433
  • 4
  • 10