Skip to content

Commit df24128

Browse files
authored
Merge branch 'main' into add-batch-secrets
2 parents 4a6ee8e + e274edc commit df24128

462 files changed

Lines changed: 7176 additions & 4478 deletions

File tree

Some content is hidden

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

CHANGELOG.v2.alpha.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
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.30.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.29.1-alpha.0...v2.30.0-alpha.0) (2022-07-01)
6+
57
## [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)
68

79
## [2.29.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.28.1-alpha.0...v2.29.0-alpha.0) (2022-06-22)

CHANGELOG.v2.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
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.30.0](https://github.com/aws/aws-cdk/compare/v2.29.1...v2.30.0) (2022-07-01)
6+
7+
### Features
8+
9+
* **appmesh:** ipv6 support for app mesh ([#20766](https://github.com/aws/aws-cdk/issues/20766)) ([b1e6d62](https://github.com/aws/aws-cdk/commit/b1e6d62ed6b6ede0362d0a68d804660e84efe5cb)), closes [#20737](https://github.com/aws/aws-cdk/issues/20737)
10+
* **cognito:** make `grant()` available on `IUserPool` ([#20799](https://github.com/aws/aws-cdk/issues/20799)) ([a1df570](https://github.com/aws/aws-cdk/commit/a1df570b89c6d456077bb934e0bf08217677ef1f)), closes [#20285](https://github.com/aws/aws-cdk/issues/20285)
11+
* **iam:** PolicyStatements can be frozen ([#20911](https://github.com/aws/aws-cdk/issues/20911)) ([3bf737b](https://github.com/aws/aws-cdk/commit/3bf737bd172eda016d2e9bb7c5f40c001399fd23))
12+
* **lambda:** grant function permissions to an AWS organization ([#19975](https://github.com/aws/aws-cdk/issues/19975)) ([2566017](https://github.com/aws/aws-cdk/commit/2566017a83ec4f9c2c5cefda4585a3f71e3516e7)), closes [#19538](https://github.com/aws/aws-cdk/issues/19538) [#20146](https://github.com/aws/aws-cdk/issues/20146)
13+
* **rds:** add missing aurora postgres versions ([#20830](https://github.com/aws/aws-cdk/issues/20830)) ([2151a0e](https://github.com/aws/aws-cdk/commit/2151a0e9b988723e050e6f37ed1780cced16c519))
14+
15+
16+
### Bug Fixes
17+
18+
* **apigateway:** Explicitly test for undefined instead of falsey for stage default options ([#20868](https://github.com/aws/aws-cdk/issues/20868)) ([b368a31](https://github.com/aws/aws-cdk/commit/b368a315cab0cedf03298083f5f1fb809bd1d1f2))
19+
* **eks:** revert shell=True and allow public ecr to work ([#20724](https://github.com/aws/aws-cdk/issues/20724)) ([de153fc](https://github.com/aws/aws-cdk/commit/de153fcdd47a4cdcd1d156d5e19684969d990c8e))
20+
* **pipelines:** 'ConfirmPermissionsBroadening' uses wrong node version ([#20861](https://github.com/aws/aws-cdk/issues/20861)) ([bac965e](https://github.com/aws/aws-cdk/commit/bac965e9c4d435ae45d5cf16aa809f33bbb05a0f))
21+
* **secretsmanager:** SecretRotation app does not set DeletionPolicy ([#20901](https://github.com/aws/aws-cdk/issues/20901)) ([f2b4eff](https://github.com/aws/aws-cdk/commit/f2b4effc903ab3a36dc925516f3329f236d03a70))
22+
523
## [2.29.1](https://github.com/aws/aws-cdk/compare/v2.29.0...v2.29.1) (2022-06-24)
624

725

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)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
[![Go Reference](https://pkg.go.dev/badge/github.com/aws/aws-cdk-go/awscdk.svg)](https://pkg.go.dev/github.com/aws/aws-cdk-go/awscdk)
1010
[![Mergify](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/aws/aws-cdk&style=flat)](https://mergify.io)
1111

12+
[![View on Construct Hub](https://constructs.dev/badge?package=aws-cdk-lib)](https://constructs.dev/packages/aws-cdk-lib)
13+
1214
The **AWS Cloud Development Kit (AWS CDK)** is an open-source software development
1315
framework to define cloud infrastructure in code and provision it through AWS CloudFormation.
1416

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-apigateway/lib/stage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export class Stage extends Resource implements IStage {
310310
};
311311

312312
// if any of them are defined, add an entry for '/*/*'.
313-
const hasCommonOptions = Object.keys(commonMethodOptions).map(v => (commonMethodOptions as any)[v]).filter(x => x).length > 0;
313+
const hasCommonOptions = Object.keys(commonMethodOptions).map(v => (commonMethodOptions as any)[v]).filter(x => x !== undefined).length > 0;
314314
if (hasCommonOptions) {
315315
settings.push(renderEntry('/*/*', commonMethodOptions));
316316
}

packages/@aws-cdk/aws-apigateway/test/stage.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Template } from '@aws-cdk/assertions';
22
import * as logs from '@aws-cdk/aws-logs';
33
import * as cdk from '@aws-cdk/core';
44
import * as apigateway from '../lib';
5+
import { ApiDefinition } from '../lib';
56

67
describe('stage', () => {
78
test('minimal setup', () => {
@@ -396,4 +397,30 @@ describe('stage', () => {
396397
accessLogFormat: testFormat,
397398
})).toThrow(/Access log format is specified without a destination/);
398399
});
400+
401+
test('default throttling settings', () => {
402+
// GIVEN
403+
const stack = new cdk.Stack();
404+
new apigateway.SpecRestApi(stack, 'testapi', {
405+
apiDefinition: ApiDefinition.fromInline({
406+
openapi: '3.0.2',
407+
}),
408+
deployOptions: {
409+
throttlingBurstLimit: 0,
410+
throttlingRateLimit: 0,
411+
metricsEnabled: false,
412+
},
413+
});
414+
415+
// THEN
416+
Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', {
417+
MethodSettings: [{
418+
DataTraceEnabled: false,
419+
HttpMethod: '*',
420+
ResourcePath: '/*',
421+
ThrottlingBurstLimit: 0,
422+
ThrottlingRateLimit: 0,
423+
}],
424+
});
425+
});
399426
});

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ const mesh = new appmesh.Mesh(this, 'AppMesh', {
4949
});
5050
```
5151

52+
A mesh with an IP preference can be created by providing the property `serviceDiscovery` that specifes an `ipPreference`.
53+
54+
```ts
55+
const mesh = new appmesh.Mesh(this, 'AppMesh', {
56+
meshName: 'myAwsMesh',
57+
serviceDiscovery: {
58+
ipPreference: appmesh.IpPreference.IPV4_ONLY,
59+
},
60+
});
61+
```
62+
5263
## Adding VirtualRouters
5364

5465
A _mesh_ uses _virtual routers_ as logical units to route requests to _virtual nodes_.
@@ -425,6 +436,48 @@ const gateway = new appmesh.VirtualGateway(this, 'gateway', {
425436
});
426437
```
427438

439+
### Adding an IP Preference to a Virtual Node
440+
441+
An `ipPreference` can be specified as part of a Virtual Node's service discovery. An IP preference defines how clients for this Virtual Node will interact with it.
442+
443+
There a four different IP preferences available to use which each specify what IP versions this Virtual Node will use and prefer.
444+
445+
- `IPv4_ONLY` - Only use IPv4. For CloudMap service discovery, only IPv4 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv4.
446+
447+
- `IPv4_PREFERRED` - Prefer IPv4 and fall back to IPv6. For CloudMap service discovery, an IPv4 address will be used if returned from CloudMap. Otherwise, an IPv6 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv4 and fall back to IPv6.
448+
449+
- `IPv6_ONLY` - Only use IPv6. For CloudMap service discovery, only IPv6 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv6.
450+
451+
- `IPv6_PREFERRED` - Prefer IPv6 and fall back to IPv4. For CloudMap service discovery, an IPv6 address will be used if returned from CloudMap. Otherwise, an IPv4 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv6 and fall back to IPv4.
452+
453+
```ts
454+
const mesh = new appmesh.Mesh(stack, 'mesh', {
455+
meshName: 'mesh-with-preference',
456+
});
457+
458+
// Virtual Node with DNS service discovery and an IP preference
459+
const dnsNode = new appmesh.VirtualNode(stack, 'dns-node', {
460+
mesh,
461+
serviceDiscovery: appmesh.ServiceDiscovery.dns('test', appmesh.DnsResponseType.LOAD_BALANCER, appmesh.IpPreference.IPV4_ONLY),
462+
});
463+
464+
// Virtual Node with CloudMap service discovery and an IP preference
465+
const vpc = new ec2.Vpc(stack, 'vpc');
466+
const namespace = new cloudmap.PrivateDnsNamespace(stack, 'test-namespace', {
467+
vpc,
468+
name: 'domain.local',
469+
});
470+
const service = namespace.createService('Svc');
471+
472+
const instanceAttribute : { [key: string]: string} = {};
473+
instanceAttribute.testKey = 'testValue';
474+
475+
const cloudmapNode = new appmesh.VirtualNode(stack, 'cloudmap-node', {
476+
mesh,
477+
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service, instanceAttribute, appmesh.IpPreference.IPV4_ONLY),
478+
});
479+
```
480+
428481
## Adding a Route
429482

430483
A _route_ matches requests with an associated virtual router and distributes traffic to its associated virtual nodes.

packages/@aws-cdk/aws-appmesh/lib/mesh.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as cdk from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnMesh } from './appmesh.generated';
4+
import { MeshServiceDiscovery } from './service-discovery';
45
import { VirtualGateway, VirtualGatewayBaseProps } from './virtual-gateway';
56
import { VirtualNode, VirtualNodeBaseProps } from './virtual-node';
67
import { VirtualRouter, VirtualRouterBaseProps } from './virtual-router';
@@ -124,6 +125,13 @@ export interface MeshProps {
124125
* @default DROP_ALL
125126
*/
126127
readonly egressFilter?: MeshFilterType;
128+
129+
/**
130+
* Defines how upstream clients will discover VirtualNodes in the Mesh
131+
*
132+
* @default - No Service Discovery
133+
*/
134+
readonly serviceDiscovery?: MeshServiceDiscovery;
127135
}
128136

129137
/**
@@ -187,6 +195,7 @@ export class Mesh extends MeshBase {
187195
egressFilter: props.egressFilter ? {
188196
type: props.egressFilter,
189197
} : undefined,
198+
serviceDiscovery: props.serviceDiscovery,
190199
},
191200
});
192201

packages/@aws-cdk/aws-appmesh/lib/service-discovery.ts

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,52 @@ import * as cloudmap from '@aws-cdk/aws-servicediscovery';
22
import { Construct } from 'constructs';
33
import { CfnVirtualNode } from './appmesh.generated';
44

5+
/**
6+
* Enum of supported IP preferences.
7+
* Used to dictate the IP version for mesh wide and virtual node service discovery.
8+
* Also used to specify the IP version that a sidecar Envoy uses when sending traffic to a local application.
9+
*/
10+
11+
export enum IpPreference {
12+
/**
13+
* Use IPv4 when sending traffic to a local application.
14+
* Only use IPv4 for service discovery.
15+
*/
16+
IPV4_ONLY = 'IPv4_ONLY',
17+
/**
18+
* Use IPv4 when sending traffic to a local application.
19+
* First attempt to use IPv4 and fall back to IPv6 for service discovery.
20+
*/
21+
IPV4_PREFERRED = 'IPv4_PREFERRED',
22+
/**
23+
* Use IPv6 when sending traffic to a local application.
24+
* Only use IPv6 for service discovery.
25+
*/
26+
IPV6_ONLY = 'IPv6_ONLY',
27+
/**
28+
* Use IPv6 when sending traffic to a local application.
29+
* First attempt to use IPv6 and fall back to IPv4 for service discovery.
30+
*/
31+
IPV6_PREFERRED = 'IPv6_PREFERRED'
32+
}
33+
34+
/**
35+
* Properties for Mesh Service Discovery
36+
*/
37+
export interface MeshServiceDiscovery {
38+
/**
39+
* IP preference applied to all Virtual Nodes in the Mesh
40+
*
41+
* @default - No IP preference is applied to any of the Virtual Nodes in the Mesh.
42+
* Virtual Nodes without an IP preference will have the following configured.
43+
* Envoy listeners are configured to bind only to IPv4.
44+
* Envoy will use IPv4 when sending traffic to a local application.
45+
* For DNS service discovery, the Envoy DNS resolver to prefer using IPv6 and fall back to IPv4.
46+
* For CloudMap service discovery, App Mesh will prefer using IPv4 and fall back to IPv6 for IPs returned by CloudMap.
47+
*/
48+
readonly ipPreference?: IpPreference;
49+
}
50+
551
/**
652
* Properties for VirtualNode Service Discovery
753
*/
@@ -48,9 +94,10 @@ export abstract class ServiceDiscovery {
4894
* @param hostname
4995
* @param responseType Specifies the DNS response type for the virtual node.
5096
* The default is `DnsResponseType.LOAD_BALANCER`.
97+
* @param ipPreference No IP preference is applied to the Virtual Node.
5198
*/
52-
public static dns(hostname: string, responseType?: DnsResponseType): ServiceDiscovery {
53-
return new DnsServiceDiscovery(hostname, responseType);
99+
public static dns(hostname: string, responseType?: DnsResponseType, ipPreference?: IpPreference): ServiceDiscovery {
100+
return new DnsServiceDiscovery(hostname, responseType, ipPreference);
54101
}
55102

56103
/**
@@ -61,9 +108,10 @@ export abstract class ServiceDiscovery {
61108
* filter instances by any custom attribute that you specified when you
62109
* registered the instance. Only instances that match all of the specified
63110
* key/value pairs will be returned.
111+
* @param ipPreference No IP preference is applied to the Virtual Node.
64112
*/
65-
public static cloudMap(service: cloudmap.IService, instanceAttributes?: {[key: string]: string}): ServiceDiscovery {
66-
return new CloudMapServiceDiscovery(service, instanceAttributes);
113+
public static cloudMap(service: cloudmap.IService, instanceAttributes?: {[key: string]: string}, ipPreference?: IpPreference): ServiceDiscovery {
114+
return new CloudMapServiceDiscovery(service, instanceAttributes, ipPreference);
67115
}
68116

69117
/**
@@ -75,18 +123,21 @@ export abstract class ServiceDiscovery {
75123
class DnsServiceDiscovery extends ServiceDiscovery {
76124
private readonly hostname: string;
77125
private readonly responseType?: DnsResponseType;
126+
private readonly ipPreference?: IpPreference;
78127

79-
constructor(hostname: string, responseType?: DnsResponseType) {
128+
constructor(hostname: string, responseType?: DnsResponseType, ipPreference?: IpPreference) {
80129
super();
81130
this.hostname = hostname;
82131
this.responseType = responseType;
132+
this.ipPreference = ipPreference;
83133
}
84134

85135
public bind(_scope: Construct): ServiceDiscoveryConfig {
86136
return {
87137
dns: {
88138
hostname: this.hostname,
89139
responseType: this.responseType,
140+
ipPreference: this.ipPreference,
90141
},
91142
};
92143
}
@@ -95,11 +146,13 @@ class DnsServiceDiscovery extends ServiceDiscovery {
95146
class CloudMapServiceDiscovery extends ServiceDiscovery {
96147
private readonly service: cloudmap.IService;
97148
private readonly instanceAttributes?: {[key: string]: string};
149+
private readonly ipPreference?: IpPreference;
98150

99-
constructor(service: cloudmap.IService, instanceAttributes?: {[key: string]: string}) {
151+
constructor(service: cloudmap.IService, instanceAttributes?: {[key: string]: string}, ipPreference?: IpPreference) {
100152
super();
101153
this.service = service;
102154
this.instanceAttributes = instanceAttributes;
155+
this.ipPreference = ipPreference;
103156
}
104157

105158
public bind(_scope: Construct): ServiceDiscoveryConfig {
@@ -108,6 +161,7 @@ class CloudMapServiceDiscovery extends ServiceDiscovery {
108161
namespaceName: this.service.namespace.namespaceName,
109162
serviceName: this.service.serviceName,
110163
attributes: renderAttributes(this.instanceAttributes),
164+
ipPreference: this.ipPreference,
111165
},
112166
};
113167
}

0 commit comments

Comments
 (0)