Skip to content

Commit 5ec536b

Browse files
authored
Merge branch 'main' into merge-back/2.53.0
2 parents 7690f43 + 837133c commit 5ec536b

File tree

558 files changed

+18769
-1378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+18769
-1378
lines changed

.github/workflows/close-stale-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
name: Stale issue job
1717
steps:
18-
- uses: aws-actions/stale-issue-cleanup@v5
18+
- uses: aws-actions/stale-issue-cleanup@v6
1919
with:
2020
# Setting messages to an empty string will cause the automation to skip
2121
# that category

.github/workflows/issue-label-assign.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ env:
142142
{"area":"@aws-cdk/aws-ec2","keywords":["aws-ec2","ec2","vpc","privatesubnet","publicsubnet","vpngateway","vpnconnection","networkacl"],"labels":["@aws-cdk/aws-ec2"],"assignees":["corymhall"]},
143143
{"area":"@aws-cdk/aws-ecr","keywords":["aws-ecr","ecr"],"labels":["@aws-cdk/aws-ecr"],"assignees":["madeline-k"]},
144144
{"area":"@aws-cdk/aws-ecr-assets","keywords":["aws-ecr-assets","ecrassets"],"labels":["@aws-cdk/aws-ecr-assets"],"assignees":["madeline-k"]},
145-
{"area":"@aws-cdk/aws-ecs","keywords":["aws-ecs","ecs"],"labels":["@aws-cdk/aws-ecs"],"assignees":["madeline-k"]},
146-
{"area":"@aws-cdk/aws-ecs-patterns","keywords":["aws-ecs-patterns","ecs-patterns"],"labels":["@aws-cdk/aws-ecs-patterns"],"assignees":["madeline-k"]},
145+
{"area":"@aws-cdk/aws-ecs","keywords":["aws-ecs","ecs"],"labels":["@aws-cdk/aws-ecs"],"assignees":["bvtujo"]},
146+
{"area":"@aws-cdk/aws-ecs-patterns","keywords":["aws-ecs-patterns","ecs-patterns"],"labels":["@aws-cdk/aws-ecs-patterns"],"assignees":["bvtujo"]},
147147
{"area":"@aws-cdk/aws-efs","keywords":["aws-efs","efs","accesspoint"],"labels":["@aws-cdk/aws-efs"],"assignees":["corymhall"]},
148148
{"area":"@aws-cdk/aws-eks","keywords":["aws-eks","eks","fargateprofile","fargatecluster"],"labels":["@aws-cdk/aws-eks"],"assignees":["otaviomacedo"]},
149149
{"area":"@aws-cdk/aws-elasticache","keywords":["aws-elasticache","elastic-cache"],"labels":["@aws-cdk/aws-elasticache"],"assignees":["otaviomacedo"]},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@types/prettier": "2.6.0",
2020
"@yarnpkg/lockfile": "^1.1.0",
21-
"cdk-generate-synthetic-examples": "^0.1.64",
21+
"cdk-generate-synthetic-examples": "^0.1.71",
2222
"conventional-changelog-cli": "^2.2.2",
2323
"fs-extra": "^9.1.0",
2424
"graceful-fs": "^4.2.10",

packages/@aws-cdk/assert-internal/lib/assertions/have-resource-matchers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export function matcherFrom(matcher: any): PropertyMatcher {
422422
* would show (in traditional JS fashion) something like '[function Function]', or more
423423
* accurately nothing at all since functions cannot be JSONified.
424424
*
425-
* We override to JSON() in order to produce a readadable version of the matcher.
425+
* We override to JSON() in order to produce a readable version of the matcher.
426426
*/
427427
export function annotateMatcher<A extends object>(how: A, matcher: PropertyMatcher): PropertyMatcher {
428428
(matcher as any).toJSON = () => how;

packages/@aws-cdk/assertions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ Here are the available APIs for `Annotations`:
594594
The corresponding `findXxx()` API is complementary to the `hasXxx()` API, except instead
595595
of asserting its presence, it returns the set of matching messages.
596596

597-
In addition, this suite of APIs is compatable with `Matchers` for more fine-grained control.
597+
In addition, this suite of APIs is compatible with `Matchers` for more fine-grained control.
598598
For example, the following assertion works as well:
599599

600600
```ts

packages/@aws-cdk/aws-apigateway/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ A usage plan specifies who can access one or more deployed API stages and method
313313
accessed. The plan uses API keys to identify API clients and meters access to the associated API stages for each key.
314314
Usage plans also allow configuring throttling limits and quota limits that are enforced on individual client API keys.
315315

316-
The following example shows how to create and asscociate a usage plan and an API key:
316+
The following example shows how to create and associate a usage plan and an API key:
317317

318318
```ts
319319
declare const integration: apigateway.LambdaIntegration;
@@ -1378,8 +1378,9 @@ api.addGatewayResponse('test-response', {
13781378
type: apigateway.ResponseType.ACCESS_DENIED,
13791379
statusCode: '500',
13801380
responseHeaders: {
1381-
'Access-Control-Allow-Origin': 'test.com',
1382-
'test-key': 'test-value',
1381+
// Note that values must be enclosed within a pair of single quotes
1382+
'Access-Control-Allow-Origin': "'test.com'",
1383+
'test-key': "'test-value'",
13831384
},
13841385
templates: {
13851386
'application/json': '{ "message": $context.error.messageString, "statusCode": "488", "type": "$context.error.responseType" }'

packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { IResource, Resource } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnGatewayResponse, CfnGatewayResponseProps } from './apigateway.generated';
44
import { IRestApi } from './restapi';
5-
import { normalizeResponseParameterValue } from './util';
65

76
/**
87
* Represents gateway response resource.
@@ -89,7 +88,7 @@ export class GatewayResponse extends Resource implements IGatewayResponse {
8988

9089
const responseParameters: { [key: string]: string } = {};
9190
for (const [header, value] of Object.entries(responseHeaders)) {
92-
responseParameters[`gatewayresponse.header.${header}`] = normalizeResponseParameterValue(value) ;
91+
responseParameters[`gatewayresponse.header.${header}`] = value;
9392
}
9493
return responseParameters;
9594
}

packages/@aws-cdk/aws-apigateway/lib/util.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ export function validateHttpMethod(method: string, messagePrefix: string = '') {
1111
}
1212
}
1313

14-
/**
15-
* Response header values need to be enclosed in single quotes.
16-
*/
17-
export function normalizeResponseParameterValue(value: string) {
18-
if (!value) {
19-
return value;
20-
}
21-
22-
// check if the value is already enclosed in single quotes
23-
if (value.startsWith("'") && value.endsWith("'")) {
24-
return value;
25-
}
26-
27-
return `'${value}'`;
28-
}
29-
3014
export function parseMethodOptionsPath(originalPath: string): { resourcePath: string, httpMethod: string } {
3115
if (!originalPath.startsWith('/')) {
3216
throw new Error(`Method options path must start with '/': ${originalPath}`);

packages/@aws-cdk/aws-apigateway/test/gateway-response.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ describe('gateway response', () => {
4545
responseHeaders: {
4646
'Access-Control-Allow-Origin': 'test.com',
4747
'test-key': 'test-value',
48-
'another-test': "'test-value-enclosed-within-single-quotes'",
4948
},
5049
});
5150

@@ -55,9 +54,8 @@ describe('gateway response', () => {
5554
RestApiId: stack.resolve(api.restApiId),
5655
StatusCode: '500',
5756
ResponseParameters: {
58-
'gatewayresponse.header.Access-Control-Allow-Origin': "'test.com'",
59-
'gatewayresponse.header.test-key': "'test-value'",
60-
'gatewayresponse.header.another-test': "'test-value-enclosed-within-single-quotes'",
57+
'gatewayresponse.header.Access-Control-Allow-Origin': 'test.com',
58+
'gatewayresponse.header.test-key': 'test-value',
6159
},
6260
ResponseTemplates: Match.absent(),
6361
});

packages/@aws-cdk/aws-appmesh/lib/virtual-node-listener.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface CommonHttpVirtualNodeListenerOptions extends VirtualNodeListenerCommon
6161
}
6262

6363
/**
64-
* Represent the HTTP Node Listener prorperty
64+
* Represent the HTTP Node Listener property
6565
*/
6666
export interface HttpVirtualNodeListenerOptions extends CommonHttpVirtualNodeListenerOptions {
6767

@@ -74,7 +74,7 @@ export interface HttpVirtualNodeListenerOptions extends CommonHttpVirtualNodeLis
7474
}
7575

7676
/**
77-
* Represent the HTTP2 Node Listener prorperty
77+
* Represent the HTTP2 Node Listener property
7878
*/
7979
export interface Http2VirtualNodeListenerOptions extends CommonHttpVirtualNodeListenerOptions {
8080
/**
@@ -86,7 +86,7 @@ export interface Http2VirtualNodeListenerOptions extends CommonHttpVirtualNodeLi
8686
}
8787

8888
/**
89-
* Represent the GRPC Node Listener prorperty
89+
* Represent the GRPC Node Listener property
9090
*/
9191
export interface GrpcVirtualNodeListenerOptions extends VirtualNodeListenerCommonOptions {
9292
/**
@@ -105,7 +105,7 @@ export interface GrpcVirtualNodeListenerOptions extends VirtualNodeListenerCommo
105105
}
106106

107107
/**
108-
* Represent the TCP Node Listener prorperty
108+
* Represent the TCP Node Listener property
109109
*/
110110
export interface TcpVirtualNodeListenerOptions extends VirtualNodeListenerCommonOptions {
111111
/**

packages/@aws-cdk/aws-autoscaling/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,36 @@ autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', {
278278
});
279279
```
280280

281+
### Block Devices
282+
283+
This type specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
284+
285+
#### GP3 Volumes
286+
287+
You can only specify the `throughput` on GP3 volumes.
288+
289+
```ts
290+
declare const vpc: ec2.Vpc;
291+
declare const instanceType: ec2.InstanceType;
292+
declare const machineImage: ec2.IMachineImage;
293+
294+
const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
295+
vpc,
296+
instanceType,
297+
machineImage,
298+
blockDevices: [{
299+
{
300+
deviceName: 'gp3-volume',
301+
volume: autoscaling.BlockDeviceVolume.ebs(15, {
302+
volumeType: autoscaling.EbsDeviceVolumeType.GP3,
303+
throughput: 125,
304+
}),
305+
},
306+
}],
307+
// ...
308+
});
309+
```
310+
281311
## Configuring Instances using CloudFormation Init
282312

283313
It is possible to use the CloudFormation Init mechanism to configure the

packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,31 @@ function synthesizeBlockDeviceMappings(construct: Construct, blockDevices: Block
21672167
}
21682168

21692169
if (ebs) {
2170-
const { iops, volumeType } = ebs;
2170+
const { iops, volumeType, throughput } = ebs;
2171+
2172+
if (throughput) {
2173+
const throughputRange = { Min: 125, Max: 1000 };
2174+
const { Min, Max } = throughputRange;
2175+
2176+
if (volumeType != EbsDeviceVolumeType.GP3) {
2177+
throw new Error('throughput property requires volumeType: EbsDeviceVolumeType.GP3');
2178+
}
2179+
2180+
if (throughput < Min || throughput > Max) {
2181+
throw new Error(
2182+
`throughput property takes a minimum of ${Min} and a maximum of ${Max}`,
2183+
);
2184+
}
2185+
2186+
const maximumThroughputRatio = 0.25;
2187+
if (iops) {
2188+
const iopsRatio = (throughput / iops);
2189+
if (iopsRatio > maximumThroughputRatio) {
2190+
throw new Error(`Throughput (MiBps) to iops ratio of ${iopsRatio} is too high; maximum is ${maximumThroughputRatio} MiBps per iops`);
2191+
}
2192+
}
2193+
}
2194+
21712195

21722196
if (!iops) {
21732197
if (volumeType === EbsDeviceVolumeType.IO1) {

packages/@aws-cdk/aws-autoscaling/lib/volume.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ export interface EbsDeviceOptionsBase {
6666
* @default {@link EbsDeviceVolumeType.GP2}
6767
*/
6868
readonly volumeType?: EbsDeviceVolumeType;
69+
70+
/**
71+
* The throughput that the volume supports, in MiB/s
72+
* Takes a minimum of 125 and maximum of 1000.
73+
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
74+
* @default - 125 MiB/s. Only valid on gp3 volumes.
75+
*/
76+
readonly throughput?: number;
6977
}
7078

7179
/**

packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,12 @@ describe('auto scaling group', () => {
699699
}, {
700700
deviceName: 'none',
701701
volume: autoscaling.BlockDeviceVolume.noDevice(),
702+
}, {
703+
deviceName: 'gp3-with-throughput',
704+
volume: autoscaling.BlockDeviceVolume.ebs(15, {
705+
volumeType: autoscaling.EbsDeviceVolumeType.GP3,
706+
throughput: 350,
707+
}),
702708
}],
703709
});
704710

@@ -739,6 +745,14 @@ describe('auto scaling group', () => {
739745
DeviceName: 'none',
740746
NoDevice: true,
741747
},
748+
{
749+
DeviceName: 'gp3-with-throughput',
750+
Ebs: {
751+
VolumeSize: 15,
752+
VolumeType: 'gp3',
753+
Throughput: 350,
754+
},
755+
},
742756
],
743757
});
744758
});
@@ -809,6 +823,71 @@ describe('auto scaling group', () => {
809823
}).toThrow(/maxInstanceLifetime must be between 1 and 365 days \(inclusive\)/);
810824
});
811825

826+
test.each([124, 1001])('throws if throughput is set less than 125 or more than 1000', (throughput) => {
827+
const stack = new cdk.Stack();
828+
const vpc = mockVpc(stack);
829+
830+
expect(() => {
831+
new autoscaling.AutoScalingGroup(stack, 'MyStack', {
832+
machineImage: new ec2.AmazonLinuxImage(),
833+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO),
834+
vpc,
835+
maxInstanceLifetime: cdk.Duration.days(0),
836+
blockDevices: [{
837+
deviceName: 'ebs',
838+
volume: autoscaling.BlockDeviceVolume.ebs(15, {
839+
volumeType: autoscaling.EbsDeviceVolumeType.GP3,
840+
throughput,
841+
}),
842+
}],
843+
});
844+
}).toThrow(/throughput property takes a minimum of 125 and a maximum of 1000/);
845+
});
846+
847+
test.each([
848+
...Object.values(autoscaling.EbsDeviceVolumeType).filter((v) => v !== 'gp3'),
849+
])('throws if throughput is set on any volume type other than GP3', (volumeType) => {
850+
const stack = new cdk.Stack();
851+
const vpc = mockVpc(stack);
852+
853+
expect(() => {
854+
new autoscaling.AutoScalingGroup(stack, 'MyStack', {
855+
machineImage: new ec2.AmazonLinuxImage(),
856+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO),
857+
vpc,
858+
maxInstanceLifetime: cdk.Duration.days(0),
859+
blockDevices: [{
860+
deviceName: 'ebs',
861+
volume: autoscaling.BlockDeviceVolume.ebs(15, {
862+
volumeType: volumeType,
863+
throughput: 150,
864+
}),
865+
}],
866+
});
867+
}).toThrow(/throughput property requires volumeType: EbsDeviceVolumeType.GP3/);
868+
});
869+
870+
test('throws if throughput / iops ratio is greater than 0.25', () => {
871+
const stack = new cdk.Stack();
872+
const vpc = mockVpc(stack);
873+
expect(() => {
874+
new autoscaling.AutoScalingGroup(stack, 'MyStack', {
875+
machineImage: new ec2.AmazonLinuxImage(),
876+
instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO),
877+
vpc,
878+
maxInstanceLifetime: cdk.Duration.days(0),
879+
blockDevices: [{
880+
deviceName: 'ebs',
881+
volume: autoscaling.BlockDeviceVolume.ebs(15, {
882+
volumeType: autoscaling.EbsDeviceVolumeType.GP3,
883+
throughput: 751,
884+
iops: 3000,
885+
}),
886+
}],
887+
});
888+
}).toThrow('Throughput (MiBps) to iops ratio of 0.25033333333333335 is too high; maximum is 0.25 MiBps per iops');
889+
});
890+
812891
test('can configure instance monitoring', () => {
813892
// GIVEN
814893
const stack = new cdk.Stack();

packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "20.0.0",
2+
"version": "21.0.0",
33
"files": {
4-
"cb1b7cc4cd8286ab836dcbb42f408e2c39d60c34a017d1dac4b998c1891d843b": {
4+
"2ca8f144c3e288148d58c9b9e86c9034f6a72b09cecffac3a5d406f8f53d5b18": {
55
"source": {
66
"path": "aws-cdk-asg-integ.template.json",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "cb1b7cc4cd8286ab836dcbb42f408e2c39d60c34a017d1dac4b998c1891d843b.json",
12+
"objectKey": "2ca8f144c3e288148d58c9b9e86c9034f6a72b09cecffac3a5d406f8f53d5b18.json",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}

0 commit comments

Comments
 (0)