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.
3,027
questions
0
votes
0
answers
5
views
How to add a behavior to an existing AWS cloudfront distribution for an API gateway using AWS CDK (typescript preferred)?
I am trying to implement a CDK project that will deploy a static website in an s3 bucket along with a CloudFront distribution. I also have an API gateway that I need to access via the same cloud-front ...
0
votes
1
answer
22
views
CDK GraphqlApi with Function Using Typescript Causes Undefined or Not Exported
I have a aws_appsync.GraphqlApi with a lambda resolver:
import * as cdk from 'aws-cdk-lib';
import {aws_appsync} from 'aws-cdk-lib';
import {Construct} from 'constructs';
import {AttributeType, ...
0
votes
1
answer
16
views
How to create a universal override function for CDK L3 construct?
I creating a AWS CDK L3 Construct in TypeScript where I can create a Dynamodb table that just enables some secure features so I don't have to constantly set these features over and over again. This is ...
0
votes
1
answer
21
views
Passing VPC from one CDK stack to another
I am having trouble getting a VPC ID from my shared infrastructure stack to another stack for creating an EC2 instance. Specifically, my error is:
AttributeError: type object 'property' has no ...
-1
votes
0
answers
18
views
Shutdown sagemaker instance at night using cdk
I have been using sagemaker recently and am using inference with GPU-based instances.
I am thinking of turning off sagemaker inference instances at night—for example, 8 pm to 8 am.
I want to do that ...
0
votes
0
answers
36
views
How to run multiple ECS tasks on the same server
I am trying to get multiple ECS tasks to run on the same EC2 server. It is a g4dn.xlarge which has 1GPU, 4CPU, and 16GB of memory.
I am using this workaround to allow the GPU to be shared between ...
0
votes
1
answer
20
views
How to add default SNS topic policy using CDK?
Hi I added a SNS topic using CDK and attached a custom policy statement like this:
const snsTopic = new Topic(this, 'SnsTopic');
const snsTopicPolicyStatement = new PolicyStatement({
effect: Effect....
0
votes
1
answer
21
views
hostedZone ID doesn't match when using custom domain for api gateway
I'm using CDK to deploy aws api gateway.
The created api gateway looks like blow, and it's mapped to hosted zone Z1UJRXOUMOOFQ8:
My Route 53 hosted zone is this, and it only has one hosted zone ...
1
vote
1
answer
39
views
Why can't I use cdk on wsl2?
I installed cdk on wsl2 and I try to use it but I get this error:
(manifest,filePath,ASSETS_SCHEMA,Manifest.patchStackTagsOnRead)}static loadAssetManifest(filePath){return this.loadManifest(filePath,...
0
votes
1
answer
57
views
Can't change RDS Postgres major version from the AWS console?
I have an RDS Postgres database, currently sitting at version 14.3.
I want to schedule a major version upgrade to 14.5 to happen during the maintenance window.
I want to do this manually via the ...
0
votes
1
answer
37
views
Caching Lambda Docker images from a CDK stack in a pipeline
For simplicity, suppose we have a stack that contains a single lambda function created as a Docker image:
import { Stack, StackProps, Duration } from 'aws-cdk-lib';
import { Construct } from '...
0
votes
1
answer
27
views
How do I modify parameters in a Container Overrides section of a Step Functions machine?
I have a Step Functions Machine the definition file of which looks as such:
"ContainerOverrides": [
{
&...
1
vote
2
answers
34
views
How to export already created (via web console) services to CDK locally and be able to deploy/update them?
Current situation:
I have an AWS API Gateway referencing some AWS Lambdas, and some Lambdas querying a DynamoDB instance.
All of the above are created and handled manually via the AWS web console. ...
0
votes
1
answer
17
views
cdk SageMaker.CfnModel outputs empty containers property when passed model package arn
When I try to pass a model package to cdk CfnModel the template output has an empty dictionary. Then input checks require an array of objects, however whatever I pass does not end up in the template ...
0
votes
1
answer
33
views
AWS CDK EC2 Instance SSH with Keypair Timing out
I've created an ec2 instance with AWS CDK in python. I've added a security group and allowed ingress rules for ipv4 and ipv6 on port 22. The keypair that I specified, with the help of this stack ...
0
votes
0
answers
19
views
Jest ToMatchSnapshot fails on unit test after aws-cdk-lib update from 2.27.0 to 2.28.0
I am working on some code that is using jest ToMatchSnapshot to compare an aws stack created from the current unit test, with one that was created prior to any code changes. The code that the unit ...
1
vote
1
answer
43
views
Network load balancer never becomes healthy
I am trying to host a service on Fargate that exposes a TCP port.
Even this simple example that exposes HTTP on port 80 never becomes healthy on Fargate.
var loadBalancedFargateService = ...
0
votes
0
answers
13
views
projen task package fail windows 11
My projen project failed while running npm run build on task package giving this error
� build » package | if [ ! -z ${CI} ]; then rsync -a . .repo --exclude .git --exclude node_modules && rm -...
0
votes
0
answers
54
views
how to check if s3 bucket exist and if not, create it if yes take it in typescript cdk?
I need to check if a bucket exist in the account and create one if the bucket does not exist or use the already existing bucket
I tried to doit like this:
import {Bucket} from 'aws-cdk-lib/aws-s3';
...
-2
votes
0
answers
32
views
IaC: CoudDevelopmentKit vs Cloudformation [closed]
AWS provides two different solutions categorised as Infrastructure as Code, CDK and Cloudformation.
What uses cases for each IaC, CDK vs Cloudformation?
1
vote
2
answers
31
views
How to pass parameters from one Pass state to another?
How to pass parameters from one Pass state to another?
aws_stepfunctions.JsonPath.string_at is working fine when invoking lambda function (insude aws_stepfunctions.TaskInput.from_object) but it is not ...
0
votes
1
answer
28
views
How to use AWS CDK CodePipeline without an oauthToken?
I have previously created a CodePipeline for building from a private GitHub Repo as below:
pipeline.addStage({
stageName: 'Source',
actions: [
new GitHubSourceAction({
actionName: '...
1
vote
0
answers
24
views
Why does CDK ALB construct create an ICMP egress disallow rule?
AWS CDK lib version: 2.62.2
When I let the CDK implicitly create the SecurityGroup as below:
this.alb = new ApplicationLoadBalancer(this, 'Alb', {
loadBalancerName: "Raido",
vpc: props....
0
votes
1
answer
41
views
AWS/Cognito, when creating a user pool through CDK, how can I set string length for standard attributes. I want to add min/max length for fullname
AWS/Cognito when creating a user pool through CDK, how can I set string length for standard attributes.
I tried to find it but had no luck like there is none for that. I am using Typescript.
My user ...
0
votes
2
answers
35
views
The argument of type "undefined" cannot be assigned to the parameter of type "Construct"
I tried example code from the AWS CDK documentation, but it didn't work as expected.
CDK version 2.62.2 in Typescript.
Everywhere (this, is standing there is is a declaration error. The argument of ...
0
votes
0
answers
36
views
AWS Step Functions - Going Back To A Previous Task
Problem: Whilst build my Step Function state in the CDK, I am encountering an issue where I cannot go back to a previous task in the step function.
Error Message: State 'See if the product id exists' ...
0
votes
1
answer
31
views
Provide cross account delegation from Route53
I have an AWS account holding my Route53 Parent Zone (example.com) and am trying to create a subdomain (beta.example.com) and (prod.example.com). After reading the documents, I realized, that I would ...
0
votes
0
answers
50
views
+100
CDK: Set the "data points to alarm" parameter for a target tracking scaling policy
I have an ECS Fargate service with autoscaling setup to track a custom metric. How do I set the "datapoints to alarm" parameter for a target tracking autoscaling policy? I don't see it in ...
0
votes
2
answers
50
views
Could not create an AWS Lambda function using CDK
I am new to CDK, I want to create simple lamda function using CDK.cdk synth gives no error but when I run cdk deploy --profile myprofile getting this error
Resource handler returned message: "...
1
vote
2
answers
59
views
"Bucket Already Exists" error when re-deploying CDK
I was working on some changes to some CDK code in my AWS account and I made a typo (lack of sleep does some crazy things) in the bucket name (the correct name is something like mybucket-alpha) so it ...
1
vote
0
answers
19
views
Trying to get AWS-Toolkit to run my lambda debug launch configuration in VS Code
I have the following launch.json config:
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "...
0
votes
1
answer
29
views
CloudFormation stack stuck in 'Create-In'Progress'
I have a cloudformation stack, which I am deploying to via my cdk package. My package contains 3 constructs (a Route53 hostedZone, a dnsValidationCertificate, and an IAM role). On a previous account, ...
0
votes
1
answer
24
views
AWS CDK - Logical ID keeps changing for HttpsRedirect (aws-route53-patterns)
I'm running into an issue where I have a stack that uses HttpsRedirect from aws-route53-patterns.
It's part of my Codepipeline and every time I release a change (even without changing any code) the ...
0
votes
0
answers
40
views
CDK deployment stuck on the CertificateManager step
I've recently started to get into AWS CloudFormation, specifically CDK.
I first added a domain manually from the Management Console to Route 53. Then, I copied the NS records that AWS picked to my ...
0
votes
1
answer
24
views
Restoring a DynamoDB table using PITR and updating Cloudformation/CDK/other services references
I have an environment where my DynamoDB table is central to a few services (a couple of lambdas, kinesis and firehoses). All of that is managed by AWS's CloudFormation/Typescript CDK.
This table has ...
0
votes
0
answers
35
views
Pipeline stack which uses cross-environment actions must have an explicitly set region
I am trying to create an AWS Code Pipeline to create a DynamoDB table in one of the stages. I was able to successfully deploy the same code with CDK v1. now trying to replicate the same on CDK v2. I ...
0
votes
1
answer
45
views
CDK Env property ignored
Many articles suggest simply explicitly setting the env property for your CDK stack in order to specify the account and region of where the stack will be deployed. E.g.
new MyStack(app, 'MyStack', {
...
2
votes
1
answer
28
views
Give AWS Lambda an AWS Managed Policy with CDK
I have a Lambda function defined in CDK. I'm using this Lambda to invoke a State Machine and for that I would need to provide it some Policies. The way I tried was the following:
const ...
0
votes
1
answer
32
views
AWS CDK Typescript Import DynamoDB table not generated in template
I am not able to import a DynamoDB table into a stack whereas I am able to import a Secret.
I double checked the arns. Both the secret and ddb are in same region. But I am not able to import ddb table ...
0
votes
1
answer
24
views
How Do I Limit A Standard FIFO Queue ThroughPut In The AWS CDK?
I have created a FIFO queue, but would like to limit the number of requests it can make, so as not to overload the server it is sending those requests to.
CDK Code:
this.intoMagento = new Queue(this, &...
1
vote
1
answer
53
views
What counts as an object vs a string in Typescript?
I am creating a Infrastructure-as-Code for a Step Functions Machine. One of these states is of type 'Task' which performs a DynamoUpdateItem on a DynamoDB table.
The code looks as following:
const ...
0
votes
2
answers
32
views
AWS CDK grant decrypt permission to Kinesis Data Stream's AWS managed CMK
I'm provisioning Kinesis Data Stream with AWS managed KMS key as well as Delivery Stream reading from stream. There's a problem on how to add decrypt policy on delivery stream role for managed key. ...
0
votes
1
answer
36
views
OpenSearch 1.3 > 2.3 upgrade, CloudFormation fails on domain update
I recently updated our CDK code to move our OpenSearch cluster from version 1.3 to 2.3. The cluster itself seems to have upgraded to a healthy state and is still accessible / usable by our ...
0
votes
0
answers
27
views
AWS CDK Bucket deployment error : No such Bucket exist
I am trying to create S3 bucket with some resources using aws cdk. The simple code to create the S3 bucket works perfectly fine but with bucket deployment, it keeps failing with the below error :
The ...
0
votes
0
answers
30
views
Unable to deploy pipeline to AWS CI/CD account
I am trying to deploy pipeline to CI/CD account. However I'm getting below error.
npm run cdk deploy LandingPagePipelineStack -- --profile cicd
> landingpage@0.3.13 cdk
> cdk deploy ...
0
votes
2
answers
53
views
AWS CDK cyclic reference for rest_api-lambda-rds stack
My setup looks like this:
*Main Stack*
RestApi
VPC (2 subnets, one public, one private_isolated)
DBStack
LambdaStack
*DBStack*
ServerlessCluster (in private_isolated VPC subnet)
*LambdaStack*
...
0
votes
1
answer
27
views
AWS CDK Assertions - Looking at Individual Resources In A Stack
Current Situation:
I have a file that has 11 different NodejsFunctions. I am looking to write assertions with CDK Template.
I have code that checks the whole stack, and says "Is there a Lambda ...
1
vote
1
answer
49
views
cdk : how to stop generating random suffix in nested stack name
I am using CDK with Python where I have a nested stack with a fixed id/name calling a custom construct also with a fixed id/name. Why does it still get a random string generated at the end of the name ...
0
votes
1
answer
67
views
How to set context to fix AWS CDK setContext error when updating past v1.9.0?
I’m trying to update some AWS CDK code past version 1.9.0 to version 1.152.0.
However, there’s one issue that is causing a problem - the setContext code is not valid anymore.
The error message I'm ...
0
votes
0
answers
22
views
props.source.bindAsNotificationRuleSource is not a function in aws cdk python
I am trying to set up notification to my codepipeline in aws.
Been following this https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_codestarnotifications/README.html
pipeline = CodePipeline(
...