Skip to content

Commit b67950d

Browse files
authored
2 parents 1529743 + 446525e commit b67950d

File tree

461 files changed

+12646
-2567
lines changed

Some content is hidden

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

461 files changed

+12646
-2567
lines changed

CHANGELOG.v2.alpha.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
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.31.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.30.0-alpha.0...v2.31.0-alpha.0) (2022-07-06)
6+
7+
8+
### Features
9+
10+
* **batch:** add secrets props to job definition ([#20871](https://github.com/aws/aws-cdk/issues/20871)) ([9b1051f](https://github.com/aws/aws-cdk/commit/9b1051f86abdfa6448b14cdae8e1ef9acb1e6688)), closes [#19506](https://github.com/aws/aws-cdk/issues/19506) [#10976](https://github.com/aws/aws-cdk/issues/10976)
11+
512
## [2.30.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.29.1-alpha.0...v2.30.0-alpha.0) (2022-07-01)
613

714
## [2.29.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.29.0-alpha.0...v2.29.1-alpha.0) (2022-06-24)

CHANGELOG.v2.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
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.31.0](https://github.com/aws/aws-cdk/compare/v2.30.0...v2.31.0) (2022-07-06)
6+
7+
8+
### Features
9+
10+
* **autoscaling:** step scaling policy supports estimatedInstanceWarmup property ([#20936](https://github.com/aws/aws-cdk/issues/20936)) ([e4c7b97](https://github.com/aws/aws-cdk/commit/e4c7b9770573e3c102e4be0c2ba0378a0b2b8767))
11+
* **aws-s3:** create default bucket policy when required (under feature flag) ([#20765](https://github.com/aws/aws-cdk/issues/20765)) ([cefa453](https://github.com/aws/aws-cdk/commit/cefa453bb3f98eb9c3f894c308ae703522de8f22)), closes [/docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3](https://github.com/aws//docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html/issues/AWS-logs-infrastructure-S3) [#18816](https://github.com/aws/aws-cdk/issues/18816)
12+
* **cfnspec:** cloudformation spec v78.1.0 ([#20952](https://github.com/aws/aws-cdk/issues/20952)) ([20d6e09](https://github.com/aws/aws-cdk/commit/20d6e0980ba9483fb0187a8cf5a256f5b59a7ba8))
13+
* **dynamodb:** imported tables always grant permissions for indexes ([#20682](https://github.com/aws/aws-cdk/issues/20682)) ([4d003a5](https://github.com/aws/aws-cdk/commit/4d003a50ae96a6c2be915edc2f6ca09eeb747fd5)), closes [#13703](https://github.com/aws/aws-cdk/issues/13703)
14+
* **ec2:** add additional instance type classes ([#20972](https://github.com/aws/aws-cdk/issues/20972)) ([400ad91](https://github.com/aws/aws-cdk/commit/400ad91cb926fb0a6d71039f8eba3bb63e7c8ca8)), closes [#20924](https://github.com/aws/aws-cdk/issues/20924)
15+
* **s3:** Event Bridge notification can be enabled after the bucket is created ([#20913](https://github.com/aws/aws-cdk/issues/20913)) ([b0b7a32](https://github.com/aws/aws-cdk/commit/b0b7a3217b1c110bcbe4580addf1ae2865ebfdf5))
16+
17+
18+
### Bug Fixes
19+
20+
* **cli:** standard log messages are sent to stderr when CI=true ([#20957](https://github.com/aws/aws-cdk/issues/20957)) ([277340d](https://github.com/aws/aws-cdk/commit/277340d4a67f81d3b80907e1899001d091780698)), closes [#7717](https://github.com/aws/aws-cdk/issues/7717)
21+
* **cloudfront:** fromOriginAccessIdentityName is a misnomer ([#20772](https://github.com/aws/aws-cdk/issues/20772)) ([3e58e5a](https://github.com/aws/aws-cdk/commit/3e58e5a3c5e12a859e4076b867444980d4b1e8e9)), closes [#20141](https://github.com/aws/aws-cdk/issues/20141)
22+
* **eks:** latest `AlbController` version isn't compatible with the chart version ([#20826](https://github.com/aws/aws-cdk/issues/20826)) ([43a0cec](https://github.com/aws/aws-cdk/commit/43a0cec380f39618f18f15da8c60cb0a4a769d37))
23+
* **route53:** cannot delete existing alias record ([#20858](https://github.com/aws/aws-cdk/issues/20858)) ([22681b1](https://github.com/aws/aws-cdk/commit/22681b1bc29ee48b3092d60cfc22726912ae607a)), closes [#20847](https://github.com/aws/aws-cdk/issues/20847)
24+
* **stepfunctions-tasks:** SqsSendMessage is missing KMS permissions ([#20990](https://github.com/aws/aws-cdk/issues/20990)) ([52b7019](https://github.com/aws/aws-cdk/commit/52b70194c946c3074b0205318564775be10f29a8))
25+
* custom resources log sensitive `ResponseURL` field ([#20899](https://github.com/aws/aws-cdk/issues/20899)) ([6b4f92f](https://github.com/aws/aws-cdk/commit/6b4f92f2437c7ff782c88ce23925a04168728d7c))
26+
527
## [2.30.0](https://github.com/aws/aws-cdk/compare/v2.29.1...v2.30.0) (2022-07-01)
628

729
### Features

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ $ yarn watch & # runs in the background
329329
[conventionalcommits](https://www.conventionalcommits.org).
330330
* The title must begin with `feat(module): title`, `fix(module): title`, `refactor(module): title` or
331331
`chore(module): title`.
332+
* `feat`: indicates a feature added (requires tests and README updates in principle, but can be suppressed)
333+
* `fix`: indicates a bug fixes (requires tests in principle, but can be suppressed)
334+
* `docs`: indicates updated documentation (docstrings or Markdown files)
335+
* `refactor`: indicates a feature-preserving refactoring
336+
* `chore`: something without directly visible user benefit (does not end up in the CHANGELOG). Typically used for build scripts, config, or changes so minor they don't warrant showing up the CHANGELOG.
332337
* Titles for `feat` and `fix` PRs end up in the change log. Think about what makes most sense for users reading the changelog while writing them.
333338
* `feat`: describe the feature (not the action of creating the commit or PR, for example, avoid words like "added" or "changed")
334339
* `fix`: describe the bug (not the solution)

docs/DESIGN_GUIDELINES.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ The AWS Construct Library, which is shipped as part of the AWS CDK constructs
126126
representing AWS resources.
127127

128128
The AWS Construct Library has multiple layers of constructs, beginning
129-
with low-level constructs, which we call _CFN Resources_ (or L1, short for
130-
"level 1") or CFN Resources (short for CloudFormation). These constructs
129+
with low-level constructs, which we call _CFN Resources_ (short for
130+
CloudFormation resources), or L1 (short for "level 1"). These constructs
131131
directly represent all resources available in AWS CloudFormation. CFN Resources
132132
are periodically generated from the AWS CloudFormation Resource
133133
Specification. They are named **Cfn**_Xyz_, where _Xyz_ is name of the
@@ -456,7 +456,7 @@ A prop should be *required* only if there is no possible sensible default value
456456
that can be provided *or calculated*.
457457

458458
Sensible defaults have a tremendous impact on the developer experience. They
459-
offer a quick way to get started with minimal cognitive, but do not limit users
459+
offer a quick way to get started with minimal cognitive load, but do not limit users
460460
from harnessing the full power of the resource, and customizing its behavior.
461461

462462
> A good way to determine what's the right sensible default is to refer to the
@@ -754,10 +754,10 @@ interface IFoo extends IConstruct {
754754
class Foo extends Construct implements IFoo {
755755
public bar() { }
756756

757-
/** @mutating */
757+
@config
758758
public goo() { }
759759

760-
public mutateMe() { } // ERROR! missing "@mutating" or missing on IFoo
760+
public mutateMe() { } // ERROR! missing "@config" or missing on IFoo
761761
}
762762
```
763763

packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export class StepScalingPolicy extends Construct {
108108
this.lowerAction = new StepScalingAction(this, 'LowerPolicy', {
109109
adjustmentType: props.adjustmentType,
110110
cooldown: props.cooldown,
111+
estimatedInstanceWarmup: props.estimatedInstanceWarmup,
111112
metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric),
112113
minAdjustmentMagnitude: props.minAdjustmentMagnitude,
113114
autoScalingGroup: props.autoScalingGroup,
@@ -138,6 +139,7 @@ export class StepScalingPolicy extends Construct {
138139
this.upperAction = new StepScalingAction(this, 'UpperPolicy', {
139140
adjustmentType: props.adjustmentType,
140141
cooldown: props.cooldown,
142+
estimatedInstanceWarmup: props.estimatedInstanceWarmup,
141143
metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric),
142144
minAdjustmentMagnitude: props.minAdjustmentMagnitude,
143145
autoScalingGroup: props.autoScalingGroup,

packages/@aws-cdk/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ describe('AutoScalingGroupRequireImdsv2Aspect', () => {
2626
machineImage: ec2.MachineImage.latestAmazonLinux(),
2727
});
2828
const launchConfig = asg.node.tryFindChild('LaunchConfig') as CfnLaunchConfiguration;
29-
launchConfig.metadataOptions = fakeToken();
29+
launchConfig.metadataOptions = cdk.Token.asAny({
30+
httpEndpoint: 'https://bla.com',
31+
} as CfnLaunchConfiguration.MetadataOptionsProperty);
3032
const aspect = new AutoScalingGroupRequireImdsv2Aspect();
3133

3234
// WHEN
@@ -61,12 +63,4 @@ describe('AutoScalingGroupRequireImdsv2Aspect', () => {
6163
},
6264
});
6365
});
64-
});
65-
66-
function fakeToken(): cdk.IResolvable {
67-
return {
68-
creationStack: [],
69-
resolve: (_c) => {},
70-
toString: () => '',
71-
};
72-
}
66+
});

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ describe('scaling', () => {
205205
namespace: 'Henk',
206206
dimensionsMap: { Mustache: 'Bushy' },
207207
}),
208+
estimatedInstanceWarmup: cdk.Duration.seconds(150),
208209
// Adjust the number of legs to be closer to 2
209210
scalingSteps: [
210211
{ lower: 0, upper: 2, change: +1 },
@@ -241,6 +242,7 @@ describe('scaling', () => {
241242
Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', {
242243
MetricAggregationType: 'Average',
243244
PolicyType: 'StepScaling',
245+
EstimatedInstanceWarmup: 150,
244246
StepAdjustments: [
245247
{
246248
MetricIntervalUpperBound: 0,

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ new batch.JobDefinition(this, 'job-def', {
300300
});
301301
```
302302

303+
### Using the secret on secrets manager
304+
305+
You can set the environment variables from secrets manager.
306+
307+
```ts
308+
const dbSecret = new secretsmanager.Secret(this, 'secret');
309+
310+
new batch.JobDefinition(this, 'batch-job-def-secrets', {
311+
container: {
312+
image: ecs.EcrImage.fromRegistry('docker/whalesay'),
313+
secrets: {
314+
PASSWORD: ecs.Secret.fromSecretsManager(dbSecret, 'password'),
315+
},
316+
},
317+
});
318+
```
319+
303320
### Importing an existing Job Definition
304321

305322
#### From ARN

packages/@aws-cdk/aws-batch/lib/job-definition.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ export interface JobDefinitionContainer {
112112
*/
113113
readonly environment?: { [key: string]: string };
114114

115+
/**
116+
* The environment variables from secrets manager or ssm parameter store
117+
*
118+
* @default none
119+
*/
120+
readonly secrets?: { [key: string]: ecs.Secret };
121+
115122
/**
116123
* The image used to start a container.
117124
*/
@@ -453,6 +460,14 @@ export class JobDefinition extends Resource implements IJobDefinition {
453460
platformCapabilities: props.platformCapabilities ?? [PlatformCapabilities.EC2],
454461
});
455462

463+
// add read secrets permission to execution role
464+
if ( props.container.secrets && props.container.executionRole ) {
465+
const executionRole = props.container.executionRole;
466+
Object.values(props.container.secrets).forEach((secret) => {
467+
secret.grantRead(executionRole);
468+
});
469+
}
470+
456471
this.jobDefinitionArn = this.getResourceArnAttribute(jobDef.ref, {
457472
service: 'batch',
458473
resource: 'job-definition',
@@ -507,6 +522,14 @@ export class JobDefinition extends Resource implements IJobDefinition {
507522
return {
508523
command: container.command,
509524
environment: this.deserializeEnvVariables(container.environment),
525+
secrets: container.secrets
526+
? Object.entries(container.secrets).map(([key, value]) => {
527+
return {
528+
name: key,
529+
valueFrom: value.arn,
530+
};
531+
})
532+
: undefined,
510533
image: this.imageConfig.imageName,
511534
instanceType: container.instanceType && container.instanceType.toString(),
512535
jobRoleArn: container.jobRole && container.jobRole.roleArn,

packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Stack } from '@aws-cdk/core';
44
import * as ec2 from '@aws-cdk/aws-ec2';
55
import * as batch from '@aws-cdk/aws-batch';
66
import * as ecs from '@aws-cdk/aws-ecs';
7+
import * as secretsmanager from '@aws-cdk/aws-secretsmanager';
78

89
class Fixture extends Stack {
910
constructor(scope: Construct, id: string) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "20.0.0",
3+
"files": {
4+
"d3685c79f9ec67f5dd6fda839a136b079f201b3d72695fe0ea3b3788c3471cc8": {
5+
"source": {
6+
"path": "batch-stack.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "d3685c79f9ec67f5dd6fda839a136b079f201b3d72695fe0ea3b3788c3471cc8.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}

packages/@aws-cdk/aws-batch/test/batch.integ.snapshot/batch-stack.template.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,14 @@
13651365
"UpdateReplacePolicy": "Retain",
13661366
"DeletionPolicy": "Retain"
13671367
},
1368+
"batchsecret7CD5E4C6": {
1369+
"Type": "AWS::SecretsManager::Secret",
1370+
"Properties": {
1371+
"GenerateSecretString": {}
1372+
},
1373+
"UpdateReplacePolicy": "Delete",
1374+
"DeletionPolicy": "Delete"
1375+
},
13681376
"batchjobdeffromecrE0E30DAD": {
13691377
"Type": "AWS::Batch::JobDefinition",
13701378
"Properties": {
@@ -1486,6 +1494,32 @@
14861494
}
14871495
}
14881496
},
1497+
"executionroleDefaultPolicy497F11A3": {
1498+
"Type": "AWS::IAM::Policy",
1499+
"Properties": {
1500+
"PolicyDocument": {
1501+
"Statement": [
1502+
{
1503+
"Action": [
1504+
"secretsmanager:DescribeSecret",
1505+
"secretsmanager:GetSecretValue"
1506+
],
1507+
"Effect": "Allow",
1508+
"Resource": {
1509+
"Ref": "batchsecret7CD5E4C6"
1510+
}
1511+
}
1512+
],
1513+
"Version": "2012-10-17"
1514+
},
1515+
"PolicyName": "executionroleDefaultPolicy497F11A3",
1516+
"Roles": [
1517+
{
1518+
"Ref": "executionroleD9A39BE6"
1519+
}
1520+
]
1521+
}
1522+
},
14891523
"batchjobdeffargate7FE30059": {
14901524
"Type": "AWS::Batch::JobDefinition",
14911525
"Properties": {
@@ -1509,6 +1543,14 @@
15091543
"Type": "MEMORY",
15101544
"Value": "512"
15111545
}
1546+
],
1547+
"Secrets": [
1548+
{
1549+
"Name": "SECRET",
1550+
"ValueFrom": {
1551+
"Ref": "batchsecret7CD5E4C6"
1552+
}
1553+
}
15121554
]
15131555
},
15141556
"PlatformCapabilities": [
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"17.0.0"}
1+
{"version":"20.0.0"}

packages/@aws-cdk/aws-batch/test/batch.integ.snapshot/integ.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "18.0.0",
2+
"version": "20.0.0",
33
"testCases": {
4-
"aws-batch/test/integ.batch": {
4+
"integ.batch": {
55
"stacks": [
66
"batch-stack"
77
],

packages/@aws-cdk/aws-batch/test/batch.integ.snapshot/manifest.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "17.0.0",
2+
"version": "20.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
@@ -285,6 +285,12 @@
285285
"data": "batchjobrepo4C508C51"
286286
}
287287
],
288+
"/batch-stack/batch-secret/Resource": [
289+
{
290+
"type": "aws:cdk:logicalId",
291+
"data": "batchsecret7CD5E4C6"
292+
}
293+
],
288294
"/batch-stack/batch-job-def-from-ecr/Resource": [
289295
{
290296
"type": "aws:cdk:logicalId",
@@ -303,6 +309,12 @@
303309
"data": "executionroleD9A39BE6"
304310
}
305311
],
312+
"/batch-stack/execution-role/DefaultPolicy/Resource": [
313+
{
314+
"type": "aws:cdk:logicalId",
315+
"data": "executionroleDefaultPolicy497F11A3"
316+
}
317+
],
306318
"/batch-stack/batch-job-def-fargate/Resource": [
307319
{
308320
"type": "aws:cdk:logicalId",

0 commit comments

Comments
 (0)