AWS CDK - aws-cloudfront - Multiple Behaviors & Origins

How to create multiple behaviors & origins with stable API? There are no examples in the...

AWS CDK CloudFront to S3 redirection

I'm using AWS CDK to setup S3 and CloudFront static website hosting. All works well until I want to redirect "http[s]//:www.mydomain.com" to "https ://mydomain.com". I do not want to make the S3...

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

Re-use existing CloudFront distribution with AWS CDK

I'm just learning AWS CDK after playing around with Serverless for a bit. Serverless has a component to deploy a static website, which uses S3 and CloudFront. It updates an existing CloudFront...

How to connect lambda to CloudFront? AWS CDK JS

Code: ``` rootOriginFunc = new cloudfront.experimental.EdgeFunction(stack, 'RootOriginFunction', { runtime: lambda.Runtime.NODEJS_14_X, handler: 'origin.handler', code:...

AWS CDK cloudfront module seems like it doesn't work well

I use AWS cli as below, it works. > aws cloudfront create-distribution --origin-domain-name EcsTe-Farga-5AIKHC7TM127-1328201825.us-west-2.elb.amazonaws.com I use AWS CloudFormation, it also...

How to setup CloudFront with ApiGateway and S3 using AWS CDK?

I'm trying to use the AWS CDK to setup a CloudFront distribution with 2 different origins: S3 ApiGateway Here's a diagram of the stack. The problem I am having is that I can't pass the domain of...

How to specify how long AWS CloudFront Access Logs are kept?

We are using AWS CDK (AWS Cloud Development Kit) to create our Cloudfront Distribution. We are creating the CloudFront Distribution with access logging enabled and specified the Amazon S3 bucket...

Can aws cdk provide remote state?

Terraform has a remote stack via well documented plugins, i.e. terraform.backend.s3 https://www.terraform.io/docs/language/settings/backends/s3.html Can aws cdk provide remote state for the...

AWS CDK error creating an ARecord for CloudFront distro

Given: export class MyARecord extends cdk.Stack { public readonly arecord: ARecord constructor(scope: cdk.Construct, id: string, props: IcARecordARecordProps) { super(scope, id, props); ...

Invalidate Cloudfront cache with AWS CDK Pipelines

As part of my CodePipeline in CDK I would like, as the last step, to invalidate the Cloudfront cache. This is my current Deploy action step: { stageName: 'Deploy', actions: [ new...

Configuring CloudFront distribution with S3 Origin and Custom Origin (ELB) using AWS CDK

I have an app that uses Django and Vue.js. Currently the API is served on api.mydomain.com that sends traffic to an Application Load Balancer which routes to Fargate services and the Vue.js static...

Use AWS CDK to set up a CloudFrontWebDistribution to have GET /subdirectory server /subdirectory/index.html from an S3 bucket

I'm using the https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/static-site AWS CDK example to configure a Cloudfront + S3 bucket to serve a static site. It does not seem like...

AWS CDK create Route 53 alias in another AWS account

There are plenty of examples of creating static sites using CDK deployed to the same AWS...

AWS CDK CORS error with Cloudfront + Static Website on S3 + API Gateway + Lambda + DynamoDb setup

I am using AWS CDK (v1.87.1 (build 9eeaa93)) to define my infrastructure as code. I use C# to define my CDK stack(s). I have my data stored in DynamoDb and an API gateway backed by Lambda...

AWS-CDK : Cross reference stack

I am trying to write a code in aws-cdk (Python) to build an infrastructure. I need to deploy a CloudFront Distribution (Stack-A) in one AWS account. Then, I need to create some DNS records for...

Cloudfront give Access denied response created through AWS CDK Python for S3 bucket origin without public Access

Created Cloud Front web distribution with AWS CDK for S3 bucket without public access. Able to create Origin access identity, and deploy but on successful deploy i get access denied response on...

How to apply correct construct to CloudFrontWebDistribution class

I am having an issue with creating an CloudFrontWebDistribution object with aws-cdk v1.7. The compiler doesn't seem to be happy about the construct I passed in. import { Stack, StackProps,...

AWS CDK: how to target an Elastic Beanstalk Environment with a Route53 Alias Record

To create an Elastic Beanstalk Application and Environment I have the following code: ```typescript // this: the class instance extending Construct const application = new CfnApplication(this,...

Which type should be used for property with nested data structure in aws cdk?

I read AWS CDK docs, especially CloudFront construct example, here. And i see 2 ways how default_behavior can be specified in cloudfront Distribution construct. It's like this: import...

CloudFront with custom Custom Lambda Function

I am trying to create CloudFront Distribution with EdgeLambda. Tried to follow this issue [https://github.com/aws/aws-cdk/issues/6259] however, I kept getting an error cdk...

AWS CDK: Assigning DB Instances to Cluster

When I use CDK to create a DatabaseCluster object, the cluster is automatically populated with two DatabaseInstances, numbered 1 (read-write) and 2 (read-only). I want to explicitly name these two...

software.amazon.jsii.JsiiException: Module '@company/cdk-tagsModule' not found

I am trying to use one of our internal generated java library by JSII from Typescript aws-cdk-library project. when we try to invoke and on cdk synth we are getting below...

AWS CDK S3 BucketDeployment - fail: Inaccessible host: cdk-hnb659fds-assets-xxxxx-us-east-1.s3.amazonaws.com'

I'm trying to upload static build react app to S3 to serve from cloudfront distribution but getting below error message. I have bootstrapped with correct AWS account and region. fail:...

CloudFront not respecting Behavior Paths -> Origins

I'm using AWS CDK to construct a CloudFront Ingress for various other microservices. It seems super inconsistent in when it works, normally only the first request, then it completely fails. I'm...

'SiteCertificate' object has no attribute 'certificate_arn' with AWS CDK

I'm trying to move a CloudFormation project to AWS CDK. I'm starting with the frontend which is a static site using a CloudFront distribution in front of an S3 bucket with a Certificate Manager...

AWS cdk create new [email protected] version

I'm using cdk to add a lambda on edge to a cloudfront web distribution (details see code below). const edgeFunction = new cloudfront.experimental.EdgeFunction(this,...

AWS Cloudfront for S3 backed website + Rest API: (Error - MethodNotAllowed / The specified method is not allowed against this resource)

I have an AWS S3 backed static website and a RestApi. I am configuring a single Cloudfront Distribution for the static website and the RestApi. I have OriginConfigs done for the S3 origins and the...

AWS CDK, creating an alias record for an existing hosted zone in Route53

I am using the AWS CDK (with Python as my deployment language) and I am trying to add an alias record of an existing cloudfront distribution to an existing hosted zone. While I can get cdk synth...

Unpredictable Cloudfront 502 errors

I have an AWS setup which involves A custom domain name attached too A cloudfront distribution with An API gateway as the origin in front of Some lambda functions that render some nextJS routes...