Skip to content

Commit e40846a

Browse files
authored
2 parents 0fc07f3 + 2c0b9c6 commit e40846a

File tree

8 files changed

+43
-29
lines changed

8 files changed

+43
-29
lines changed

CHANGELOG.v2.alpha.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5-
## [2.154.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.153.0-alpha.0...v2.154.0-alpha.0) (2024-08-21)
5+
## [2.154.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.153.0-alpha.0...v2.154.0-alpha.0) (2024-08-22)
66

77

88
### Features

CHANGELOG.v2.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5-
## [2.154.0](https://github.com/aws/aws-cdk/compare/v2.153.0...v2.154.0) (2024-08-21)
5+
## [2.154.0](https://github.com/aws/aws-cdk/compare/v2.153.0...v2.154.0) (2024-08-22)
66

77

88
### Features
@@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file. See [standa
2828

2929
### Bug Fixes
3030

31+
* **cloudfront:** requirement of domainNames prevents moving a domain name between distributions ([#31001](https://github.com/aws/aws-cdk/issues/31001)) ([acdf7d3](https://github.com/aws/aws-cdk/commit/acdf7d3a1ffe2cbc8239cd0b788dc47b99e35184)), closes [#29960](https://github.com/aws/aws-cdk/issues/29960) [#29329](https://github.com/aws/aws-cdk/issues/29329)
3132
* **elasticloadbalancingv2-targets:** add AlbListenerTarget for NLBs, deprecate AlbTarget due to ALB listener race conditions ([#17208](https://github.com/aws/aws-cdk/issues/17208)) ([#30396](https://github.com/aws/aws-cdk/issues/30396)) ([1fca1e5](https://github.com/aws/aws-cdk/commit/1fca1e5b92ba760a33652f39c2345f6aa1eaa9f7)), closes [/github.com/aws/aws-cdk/issues/17208#issuecomment-1681475590](https://github.com/aws//github.com/aws/aws-cdk/issues/17208/issues/issuecomment-1681475590)
3233
* **lambda:** validate localMountPath format and length ([#31019](https://github.com/aws/aws-cdk/issues/31019)) ([c159e77](https://github.com/aws/aws-cdk/commit/c159e77ab34701fc6780b9501f1692fbf2366b04))
3334
* **vpc-v2:** fixing default scope id ([#31102](https://github.com/aws/aws-cdk/issues/31102)) ([0007a29](https://github.com/aws/aws-cdk/commit/0007a29714cf04abb307845874dde27c813d45dd))

packages/aws-cdk-lib/aws-cloudfront/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ new cloudfront.Distribution(this, 'myDist', {
115115
});
116116
```
117117

118+
#### Moving an alternate domain name to a different distribution
119+
120+
When you try to add an alternate domain name to a distribution but the alternate domain name is already in use on a different distribution, you get a `CNAMEAlreadyExists` error (One or more of the CNAMEs you provided are already associated with a different resource).
121+
122+
In that case, you might want to move the existing alternate domain name from one distribution (the source distribution) to another (the target distribution). The following steps are an overview of the process. For more information, see [Moving an alternate domain name to a different distribution](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/alternate-domain-names-move.html).
123+
124+
1. Deploy the stack with the target distribution. The `certificate` property must be specified but the `domainNames` should be absent.
125+
2. Move the alternate domain name by running CloudFront `associate-alias` command. For the example and preconditions, see the AWS documentation above.
126+
3. Specify the `domainNames` property with the alternative domain name, then deploy the stack again to resolve the drift at the alternative domain name.
127+
118128
#### Cross Region Certificates
119129

120130
> **This feature is currently experimental**

packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ export interface DistributionProps {
129129
*
130130
* If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name,
131131
* you can add an alternate domain name to your distribution. If you attach a certificate to the distribution,
132-
* you must add (at least one of) the domain names of the certificate to this list.
132+
* you should add (at least one of) the domain names of the certificate to this list.
133+
*
134+
* When you want to move a domain name between distributions, you can associate a certificate without specifying any domain names.
135+
* For more information, see the _Moving an alternate domain name to a different distribution_ section in the README.
133136
*
134137
* @default - The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net)
135138
*/
@@ -318,10 +321,6 @@ export class Distribution extends Resource implements IDistribution {
318321
if (!Token.isUnresolved(certificateRegion) && certificateRegion !== 'us-east-1') {
319322
throw new Error(`Distribution certificates must be in the us-east-1 region and the certificate you provided is in ${certificateRegion}.`);
320323
}
321-
322-
if ((props.domainNames ?? []).length === 0) {
323-
throw new Error('Must specify at least one domain name to use a certificate with a distribution');
324-
}
325324
}
326325

327326
const originId = this.addOrigin(props.defaultBehavior.origin);

packages/aws-cdk-lib/aws-cloudfront/test/distribution.test.ts

+13-14
Original file line numberDiff line numberDiff line change
@@ -457,23 +457,22 @@ describe('certificates', () => {
457457
}).toThrow(/Distribution certificates must be in the us-east-1 region and the certificate you provided is in eu-west-1./);
458458
});
459459

460-
test('adding a certificate without a domain name throws', () => {
460+
test('adding a certificate without a domain name', () => {
461461
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
462462

463-
expect(() => {
464-
new Distribution(stack, 'Dist1', {
465-
defaultBehavior: { origin: defaultOrigin() },
466-
certificate,
467-
});
468-
}).toThrow(/Must specify at least one domain name/);
463+
new Distribution(stack, 'Dist1', {
464+
defaultBehavior: { origin: defaultOrigin() },
465+
certificate,
466+
});
469467

470-
expect(() => {
471-
new Distribution(stack, 'Dist2', {
472-
defaultBehavior: { origin: defaultOrigin() },
473-
domainNames: [],
474-
certificate,
475-
});
476-
}).toThrow(/Must specify at least one domain name/);
468+
Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', {
469+
DistributionConfig: {
470+
Aliases: Match.absent(),
471+
ViewerCertificate: {
472+
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
473+
},
474+
},
475+
});
477476
});
478477

479478
test('use the TLSv1.2_2021 security policy by default', () => {

packages/aws-cdk-lib/custom-resources/lib/custom-resource-config/custom-resource-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const CUSTOM_RESOURCE_SINGLETON_LOG_RETENTION = 'aws:cdk:is-custom-resour
1212

1313
/**
1414
* Manages AWS-vended Custom Resources
15+
*
1516
* This feature is currently experimental.
1617
*/
1718
export class CustomResourceConfig {
@@ -42,6 +43,8 @@ export class CustomResourceConfig {
4243

4344
/**
4445
* Manages log retention for AWS-vended custom resources.
46+
*
47+
* This feature is currently experimental.
4548
*/
4649
export class CustomResourceLogRetention implements IAspect {
4750
private readonly logRetention: logs.RetentionDays;
@@ -89,6 +92,8 @@ export class CustomResourceLogRetention implements IAspect {
8992

9093
/**
9194
* Manages removal policy for AWS-vended custom resources.
95+
*
96+
* This feature is currently experimental.
9297
*/
9398
export class CustomResourceRemovalPolicy implements IAspect {
9499
private readonly removalPolicy: RemovalPolicy;

packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ export const CLOUDWATCH_LAMBDA_INSIGHTS_ARNS: { [key: string]: any } = {
528528
'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:52',
529529
'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:79',
530530
'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:51',
531-
// 'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:12',
531+
'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:12',
532532
'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:42',
533533
'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:42',
534534
'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:52',
@@ -591,7 +591,7 @@ export const CLOUDWATCH_LAMBDA_INSIGHTS_ARNS: { [key: string]: any } = {
591591
'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:51',
592592
'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:78',
593593
'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:50',
594-
// 'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:11',
594+
'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:11',
595595
'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:41',
596596
'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:41',
597597
'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:51',
@@ -652,7 +652,7 @@ export const CLOUDWATCH_LAMBDA_INSIGHTS_ARNS: { [key: string]: any } = {
652652
'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:49',
653653
'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:76',
654654
'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:48',
655-
// 'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:9',
655+
'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:9',
656656
'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:39',
657657
'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:39',
658658
'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:49',
@@ -711,7 +711,7 @@ export const CLOUDWATCH_LAMBDA_INSIGHTS_ARNS: { [key: string]: any } = {
711711
'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:45',
712712
'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:72',
713713
'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:44',
714-
// 'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:4',
714+
'ca-west-1': 'arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:4',
715715
'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:36',
716716
'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:36',
717717
'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:45',

packages/aws-cdk-lib/region-info/test/__snapshots__/region-info.test.ts.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -664,10 +664,10 @@ exports[`built-in data is correct 1`] = `
664664
"1.0.143.0": undefined,
665665
"1.0.178.0": undefined,
666666
"1.0.229.0": undefined,
667-
"1.0.273.0": undefined,
668-
"1.0.275.0": undefined,
669-
"1.0.295.0": undefined,
670-
"1.0.317.0": undefined,
667+
"1.0.273.0": "arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:4",
668+
"1.0.275.0": "arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:9",
669+
"1.0.295.0": "arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:11",
670+
"1.0.317.0": "arn:aws:lambda:ca-west-1:946466191631:layer:LambdaInsightsExtension:12",
671671
"1.0.54.0": undefined,
672672
"1.0.86.0": undefined,
673673
"1.0.89.0": undefined,

0 commit comments

Comments
 (0)