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

Almost same parameters for different function python

for example I have code as below: if env = 'staging': db_cluster = rds.DatabaseCluster(self, instances=2, identifier='ksdfjdsk', …
1
vote
1 answer

Cannot seem to fetch SSM Parameter at deploy with CDK

I'm currently trying a fetch a parameter for my pipeline through the CDK SSM Parameter library, however I seem to face a weird issue: CfnParameter at 'nonProdAccountId.Parameter' should be created in the scope of a Stack, but no Stack…
Fares
  • 893
  • 1
  • 11
  • 24
1
vote
1 answer

Is there any command to overwrite existing `S3` and `ECR` such as `--force` on CDK

I am developing using AWS CDK and I often hit this error. I understand it is important. however when developing, I want to do some trial and error deploy/destroy. This error is very troublesome. Is there any command to overwrite existing S3 and ECR…
whitebear
  • 11,200
  • 24
  • 114
  • 237
1
vote
1 answer

Pushing docker image to the target repository by aws-cdk

I have two stacks CdkVrStack and CdkVrDeployStack in CdkVrStack, repository my-repo-name is created. export class CdkVrStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { const repo_ = new ecr.Repository(this,…
whitebear
  • 11,200
  • 24
  • 114
  • 237
1
vote
2 answers

Adding managed policy aws with cdk

I am trying to add a managed policy to a role that contains an account id: const role = iam.Role.fromRoleArn( this, 'Role', `arn:aws:iam::${cdk.Stack.of(this).account}:role/example-role`, ); …
Aziz.G
  • 3,599
  • 2
  • 17
  • 35
1
vote
2 answers

Using the CfnOutput created inside a LambdaRestApi in AWS CDK

I'm creating a LambdaRestApi as follows this.gateway = new apigw.LambdaRestApi(this, "Endpoint", { handler: hello, endpointExportName: "MainURL" }) and I'd like to get to the CfnOutput it generates, is it…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
1
vote
0 answers

BadRequestException when calling the ExecuteStatement operation on Aurora Serverless db

I have a lambda function that retrieves records from AWS Aurora Serverless db. Now I thought of adding api gateway to trigger the lambda function but I get this error. [ERROR] BadRequestException: An error occurred (BadRequestException) when calling…
1
vote
0 answers

Create database from snapshot if snapshot exist, else create new database

I am currently working on an environment that gets destroyed every night and redeployed every morning. The CDK provides a construct named DatabaseInstanceFromSnapshot but this won't create one if there is no snapshot available. Is there a way to…
Tom
  • 403
  • 3
  • 14
1
vote
1 answer

Update DynamoDB table from another stack in AWS CDK

I'm looking for a TypeScript code to update DynamoDB created in one stack from another stack by using lambda and API gateway. Both stacks are in the same environment. Please advice, if this is doable.
1
vote
1 answer

Cognito attribute mapping with CDK / CloudFormation

Based on what's described here and on other pages, I created via CDK a Cognito User Pool and an Identity Pool, and, after manually mapping the custom attributes, access is granted based on the custom attributes in the User Pool. Now I'm trying to do…
1
vote
1 answer

Rename a S3 file using AWS CDK

I wish to rename a file that exists in S3 using CDK. That's pretty much it. The closest thing I found was BucketDeployment and it doesn't work for this purpose. Is there a way to do this, or should I just write a lambda?
Avi Jain
  • 99
  • 1
  • 8
1
vote
2 answers

How best to retrieve AWS SSM parameters from the AWS CDK?

Apologies if this is a duplicate, I'm going a bit snowblind with blogs and articles trying to find a solution. I'm trying to use the AWS CDK to deploy a Stack - specifically a CloudFront Distribution layered over an S3 Bucket. I want to retrieve a…
shearn89
  • 798
  • 1
  • 9
  • 24
1
vote
1 answer

EKS Cluster Name issue || CDK

I'm creating EKS cluster using AWS CDK. I want to assigned clustername as per the environment. We have prefix for each environment in SSM parameter. I'm trying to specifiy cluster name as follows: First step- fetch prefix: const clusternamevalue =…
Vikas Banage
  • 494
  • 1
  • 8
  • 25
1
vote
1 answer

How do I retrieve the apiId when creating a CfnDeployment via CDK?

I'm using aws-cdk-lib version 2 to create a CloudFormation stack. I define my API as follows: const api = new apigatewayv2.CfnApi(this, 'MyApi', { body: YAML.parse(apiSpec), failOnWarnings: true }); This successfully creates my API on deploy. Now…
w.brian
  • 16,296
  • 14
  • 69
  • 118
1
vote
2 answers

deployed static website using cdk - direct link to pages shows access denied

I have deployed my website here: https://curlycactus.com/ if you traverse the links, all the pages work fine. But when I copy and paste the direct link for example this: https://curlycactus.com/work/1 I get this…
ArmenB
  • 2,125
  • 3
  • 23
  • 47