Skip to content

Commit c88d42b

Browse files
authored
Merge branch 'master' into epolon/eks-multiple-owned-sgs
2 parents 7ba243c + 646f098 commit c88d42b

File tree

15 files changed

+897
-124
lines changed

15 files changed

+897
-124
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
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+
## [1.81.0](https://github.com/aws/aws-cdk/compare/v1.80.0...v1.81.0) (2020-12-30)
6+
7+
8+
### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES
9+
10+
* **eks:** the `@aws-cdk/eks.KubectlLayer` layer class has been moved to `@aws-cdk/lambda-layer-kubectl.KubectlLayer`.
11+
12+
### Features
13+
14+
* **codebuild:** add `webhookTriggersBatchBuild` option to third-party Git sources ([#11743](https://github.com/aws/aws-cdk/issues/11743)) ([d9353b7](https://github.com/aws/aws-cdk/commit/d9353b7625420595401620709828de2f44c66597)), closes [#11663](https://github.com/aws/aws-cdk/issues/11663)
15+
* **codebuild:** prevent using Secrets in plain-text environment variables ([#12150](https://github.com/aws/aws-cdk/issues/12150)) ([998af8f](https://github.com/aws/aws-cdk/commit/998af8f0e574b7b07083f0f347dc4934a6da1966))
16+
* **ecs:** deployment circuit breaker support ([#12168](https://github.com/aws/aws-cdk/issues/12168)) ([e8801a0](https://github.com/aws/aws-cdk/commit/e8801a0ddb04e75de87ba34f3a58b1adebae5301))
17+
* **ecs-patterns:** containerName for QueueProcessingEc2Service ([88d4149](https://github.com/aws/aws-cdk/commit/88d4149432d55e65b23448fd58d8ec3e96f3e72c)), closes [#10517](https://github.com/aws/aws-cdk/issues/10517)
18+
* Configre containerName for QueueProcessingFargateService ([fad27f6](https://github.com/aws/aws-cdk/commit/fad27f65a73dc3b9c208439c5e474295491381da))
19+
* **eks:** aws-node-termination-handler for spot instances now pulls the image from public ECR ([#12141](https://github.com/aws/aws-cdk/issues/12141)) ([c752fab](https://github.com/aws/aws-cdk/commit/c752fabf2022b5e697b6bf900e7878076f28b31a)), closes [#12134](https://github.com/aws/aws-cdk/issues/12134)
20+
* **eks:** bundle kubectl, helm and awscli instead of SAR app ([#12129](https://github.com/aws/aws-cdk/issues/12129)) ([63bc98f](https://github.com/aws/aws-cdk/commit/63bc98f0d4a85b1c544d78420fd44579ce46a806)), closes [#11874](https://github.com/aws/aws-cdk/issues/11874)
21+
* **eks:** option to disable manifest validation ([#12012](https://github.com/aws/aws-cdk/issues/12012)) ([579b923](https://github.com/aws/aws-cdk/commit/579b9235706d6848847a258bbb607a9bff6a9e11)), closes [#11763](https://github.com/aws/aws-cdk/issues/11763)
22+
* **eks:** spot support for managed nodegroups ([#11962](https://github.com/aws/aws-cdk/issues/11962)) ([6ccd00f](https://github.com/aws/aws-cdk/commit/6ccd00fc7641f3696559367d65733b66df707fa7)), closes [#11827](https://github.com/aws/aws-cdk/issues/11827)
23+
* **elasticsearch:** add support for version 7_8 and 7_9 ([#12222](https://github.com/aws/aws-cdk/issues/12222)) ([09d1f6c](https://github.com/aws/aws-cdk/commit/09d1f6cae610477c17234eab4a02fc731e34e2cf)), closes [#12202](https://github.com/aws/aws-cdk/issues/12202)
24+
* **elasticsearch:** Support `EnableVersionUpgrade` update policy ([#12239](https://github.com/aws/aws-cdk/issues/12239)) ([14f8b06](https://github.com/aws/aws-cdk/commit/14f8b06686368da15211dbd528928ad4000d9eb8)), closes [#12210](https://github.com/aws/aws-cdk/issues/12210)
25+
* **rds:** add grantConnect for RDS Proxy ([#12243](https://github.com/aws/aws-cdk/issues/12243)) ([eb45ca8](https://github.com/aws/aws-cdk/commit/eb45ca816626b243daacbd3a8916ac1e5db202ea)), closes [#10133](https://github.com/aws/aws-cdk/issues/10133)
26+
* **rds:** add support for setting public accessibility ([#12164](https://github.com/aws/aws-cdk/issues/12164)) ([b8f48e5](https://github.com/aws/aws-cdk/commit/b8f48e514c09d2f46d8bbae27171877df61e7f2a)), closes [#12093](https://github.com/aws/aws-cdk/issues/12093)
27+
* **s3:** option to auto delete objects upon bucket removal ([#12090](https://github.com/aws/aws-cdk/issues/12090)) ([32e9c23](https://github.com/aws/aws-cdk/commit/32e9c23be2852cfca79a57c90e52b9301b1c7081)), closes [#3297](https://github.com/aws/aws-cdk/issues/3297) [#9751](https://github.com/aws/aws-cdk/issues/9751)
28+
29+
30+
### Bug Fixes
31+
32+
* **codebuild:** missing permissions for SecretsManager environment variables ([#12121](https://github.com/aws/aws-cdk/issues/12121)) ([1a13d8f](https://github.com/aws/aws-cdk/commit/1a13d8fbb3ea4edd4ff8fb0a2608547f63b902f9))
33+
* **codebuild:** Project lacks permissions to its log destinations ([#12213](https://github.com/aws/aws-cdk/issues/12213)) ([b92ed51](https://github.com/aws/aws-cdk/commit/b92ed51c6ff11f8453755b6381a3cf1f12b0fcc1)), closes [#11444](https://github.com/aws/aws-cdk/issues/11444) [#12179](https://github.com/aws/aws-cdk/issues/12179)
34+
* **codepipeline-actions:** use codebuild batch iam permissions when `executeBatchBuild: true` ([#12181](https://github.com/aws/aws-cdk/issues/12181)) ([5279f37](https://github.com/aws/aws-cdk/commit/5279f37288283a37c952440a7f2082517c56af3a))
35+
* **elasticsearch:** domain configured with access policies and a custom kms key fails to deploy ([#11699](https://github.com/aws/aws-cdk/issues/11699)) ([245ee6a](https://github.com/aws/aws-cdk/commit/245ee6a1253eeaa79177e960c164bf3a409d2e57))
36+
537
## [1.80.0](https://github.com/aws/aws-cdk/compare/v1.79.0...v1.80.0) (2020-12-22)
638

739

packages/@aws-cdk/aws-codepipeline-actions/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,70 @@ const deployStage = pipeline.addStage({
689689
});
690690
```
691691

692+
#### Invalidating the CloudFront cache when deploying to S3
693+
694+
There is currently no native support in CodePipeline for invalidating a CloudFront cache after deployment.
695+
One workaround is to add another build step after the deploy step,
696+
and use the AWS CLI to invalidate the cache:
697+
698+
```ts
699+
// Create a Cloudfront Web Distribution
700+
const distribution = new cloudfront.Distribution(this, `Distribution`, {
701+
// ...
702+
});
703+
704+
// Create the build project that will invalidate the cache
705+
const invalidateBuildProject = new codebuild.PipelineProject(this, `InvalidateProject`, {
706+
buildSpec: codebuild.BuildSpec.fromObject({
707+
version: '0.2',
708+
phases: {
709+
build: {
710+
commands:[
711+
'aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "/*"',
712+
// Choose whatever files or paths you'd like, or all files as specified here
713+
],
714+
},
715+
},
716+
}),
717+
environmentVariables: {
718+
CLOUDFRONT_ID: { value: distribution.distributionId },
719+
},
720+
});
721+
722+
// Add Cloudfront invalidation permissions to the project
723+
const distributionArn = `arn:aws:cloudfront::${this.account}:distribution/${distribution.distributionId}`;
724+
invalidateBuildProject.addToRolePolicy(new iam.PolicyStatement({
725+
resources: [distributionArn],
726+
actions: [
727+
'cloudfront:CreateInvalidation',
728+
],
729+
}));
730+
731+
// Create the pipeline (here only the S3 deploy and Invalidate cache build)
732+
new codepipeline.Pipeline(this, 'Pipeline', {
733+
stages: [
734+
// ...
735+
{
736+
stageName: 'Deploy',
737+
actions: [
738+
new codepipelineActions.S3DeployAction({
739+
actionName: 'S3Deploy',
740+
bucket: deployBucket,
741+
input: deployInput,
742+
runOrder: 1,
743+
}),
744+
new codepipelineActions.CodeBuildAction({
745+
actionName: 'InvalidateCache',
746+
project: invalidateBuildProject,
747+
input: deployInput,
748+
runOrder: 2,
749+
}),
750+
],
751+
},
752+
],
753+
});
754+
```
755+
692756
### Alexa Skill
693757

694758
You can deploy to Alexa using CodePipeline with the following Action:

packages/@aws-cdk/aws-elasticsearch/lib/domain.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,21 @@ export class Domain extends DomainBase implements IDomain {
15831583
accessPolicies: accessPolicyStatements,
15841584
});
15851585

1586+
if (props.encryptionAtRest?.kmsKey) {
1587+
1588+
// https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/encryption-at-rest.html
1589+
1590+
// these permissions are documented as required during domain creation.
1591+
// while not strictly documented for updates as well, it stands to reason that an update
1592+
// operation might require these in case the cluster uses a kms key.
1593+
// empircal evidence shows this is indeed required: https://github.com/aws/aws-cdk/issues/11412
1594+
accessPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({
1595+
actions: ['kms:List*', 'kms:Describe*', 'kms:CreateGrant'],
1596+
resources: [props.encryptionAtRest.kmsKey.keyArn],
1597+
effect: iam.Effect.ALLOW,
1598+
}));
1599+
}
1600+
15861601
accessPolicy.node.addDependency(this.domain);
15871602
}
15881603
}

packages/@aws-cdk/aws-elasticsearch/test/domain.test.ts

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable jest/expect-expect */
22
import '@aws-cdk/assert/jest';
3-
import { ResourcePart } from '@aws-cdk/assert';
3+
import * as assert from '@aws-cdk/assert';
44
import { Metric, Statistic } from '@aws-cdk/aws-cloudwatch';
55
import { Subnet, Vpc, EbsDeviceVolumeType } from '@aws-cdk/aws-ec2';
66
import * as iam from '@aws-cdk/aws-iam';
7+
import * as kms from '@aws-cdk/aws-kms';
78
import * as logs from '@aws-cdk/aws-logs';
89
import { App, Stack, Duration, SecretValue } from '@aws-cdk/core';
910
import { Domain, ElasticsearchVersion } from '../lib';
@@ -27,6 +28,44 @@ const readWriteActions = [
2728
...writeActions,
2829
];
2930

31+
test('grants kms permissions if needed', () => {
32+
33+
const key = new kms.Key(stack, 'Key');
34+
35+
new Domain(stack, 'Domain', {
36+
version: ElasticsearchVersion.V7_1,
37+
encryptionAtRest: {
38+
kmsKey: key,
39+
},
40+
// so that the access policy custom resource will be used.
41+
useUnsignedBasicAuth: true,
42+
});
43+
44+
const expectedPolicy = {
45+
Statement: [
46+
{
47+
Action: [
48+
'kms:List*',
49+
'kms:Describe*',
50+
'kms:CreateGrant',
51+
],
52+
Effect: 'Allow',
53+
Resource: {
54+
'Fn::GetAtt': [
55+
'Key961B73FD',
56+
'Arn',
57+
],
58+
},
59+
},
60+
],
61+
Version: '2012-10-17',
62+
};
63+
64+
const resources = assert.expect(stack).value.Resources;
65+
expect(resources.AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E.Properties.PolicyDocument).toStrictEqual(expectedPolicy);
66+
67+
});
68+
3069
test('minimal example renders correctly', () => {
3170
new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_1 });
3271

@@ -79,7 +118,7 @@ test('can enable version upgrade update policy', () => {
79118
UpdatePolicy: {
80119
EnableVersionUpgrade: true,
81120
},
82-
}, ResourcePart.CompleteDefinition);
121+
}, assert.ResourcePart.CompleteDefinition);
83122
});
84123

85124
describe('log groups', () => {

0 commit comments

Comments
 (0)