Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge #29

Merged
merged 135 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
e51921d
feat(eks): Support cdk8s charts (#10562)
iliapolo Oct 6, 2020
b7a13ee
chore: don't pack `test` directories (#10728)
rix0rrr Oct 6, 2020
0297f31
fix(pipelines): pipeline doesn't restart if CLI version changes (#10727)
rix0rrr Oct 6, 2020
c4fe494
chore(monocdk-experiment): rename package name to monocdk (#10743)
NetaNir Oct 6, 2020
8006459
fix(stepfunctions): X-Ray policy does not match documentation (#10721)
hoegertn Oct 6, 2020
1559fe9
feat(rds): add clusterArn property to IServerlessCluster (#10741)
asterikx Oct 6, 2020
c58127b
chore(monocdk): fix dotnet naming (#10747)
NetaNir Oct 7, 2020
4864fa0
chore(cli): "cdk context" is broken (#10751)
NetaNir Oct 7, 2020
41f6de2
feat(efs): add support for backup policy (#10524)
ayush987goyal Oct 7, 2020
d1a6e88
chore: upgrade jsonschema minor version (#10758)
NetaNir Oct 7, 2020
4f46341
docs(ec2): fix block device example in README (#10760)
udondan Oct 7, 2020
8b9a5cf
chore(rds): add additional mysql engine versions (#10757)
neilkuan Oct 7, 2020
6078cab
feat(cfnspec): cloudformation spec v18.6.0 (#10762)
aws-cdk-automation Oct 7, 2020
effed09
fix(redshift): Allow redshift cluster securityGroupName to be generat…
mitchlloyd Oct 7, 2020
dbb7e34
feat(cloudfront-origins): customize origin access identity in s3origi…
wtho Oct 7, 2020
1123f07
chore(cfnspec): drop step functions patch as the updated spec has res…
shivlaks Oct 7, 2020
e0d0e11
chore(release): 1.67.0
Oct 7, 2020
6b74184
Update CHANGELOG.md
NetaNir Oct 7, 2020
3104084
Update CHANGELOG.md
NetaNir Oct 7, 2020
5a97d27
feat(cloudfront): support for cache policies (#10656)
njlynch Oct 7, 2020
2b4dd71
chore(release): 1.67.0 (#10771)
mergify[bot] Oct 7, 2020
08efc96
feat(cloudfront): support for origin request policies (#10765)
njlynch Oct 7, 2020
8bee193
fix(events): cannot use tokens as event bus name (#10772)
shivlaks Oct 7, 2020
a6ad2bc
Merge branch 'master' into merge-back/1.67.0
mergify[bot] Oct 7, 2020
a3790be
chore(merge-back): 1.67.0 (#10773)
mergify[bot] Oct 7, 2020
f7ce079
fix(core): partial wildcards don't work with selective bundling (#10767)
quantumew Oct 8, 2020
55fa055
fix(ec2): VPN preSharedKey cannot be a Token (#10725)
mmuller88 Oct 8, 2020
a4bac34
feat(eks): Auto select AMI type for T4g instance type (#10360)
pahud Oct 8, 2020
6b3687c
fix(s3-deployment): User metadata was added with wrong prefix (x-amzn…
ayush987goyal Oct 8, 2020
50db417
chore(eks): readme touchups (#10786)
neilkuan Oct 8, 2020
dd737ad
chore(secretsmanager): migrate tests to jest (#10768)
jogold Oct 8, 2020
a70864d
chore(eslint-plugin-cdk): use a fixed directory for test output withi…
blaenk Oct 8, 2020
f9afbc5
feat(pipelines): support SecurityGroups for ShellScriptAction (#10770)
nbaillie Oct 8, 2020
09da33a
chore(rds): add validation for backup retention period in serverless …
shivlaks Oct 8, 2020
60ab50f
feat(codedeploy): Custom lambda deployment config (#10462)
flemjame-at-amazon Oct 8, 2020
45b1e36
feat(apigateway): metric methods for RestApi (#10667)
ayush987goyal Oct 9, 2020
23f77fd
feat(apigateway): grant methods to ApiKey (#10633)
ayush987goyal Oct 9, 2020
71aa4b6
chore(apigateway): restApiName is not a physicalName (#10805)
Oct 9, 2020
c39cf95
fix(s3): correct write permission with key decrypt (#10679)
ayush987goyal Oct 9, 2020
227fb81
feat(s3): Support virtual-hosted style bucket URLs (#10326)
acomagu Oct 9, 2020
d88f034
fix(core): CfnCodeDeployBlueGreenHook outputs empty optional objects …
skinny85 Oct 9, 2020
12aa61b
chore: remove unnecessary ruby prerequisites (#10804)
RomainMuller Oct 10, 2020
d34773f
fix(lambda-nodejs): cache performance (#10763)
jogold Oct 11, 2020
37fdc94
feat(core): `BundlingDockerImage` now supports `run()` and `cp()` uti…
misterjoshua Oct 11, 2020
f7cfcee
chore(init/java): use latest exec-maven-plugin (#9219)
sullis Oct 12, 2020
733d72d
chore(dynamodb): fix nonKeyAttributes limit test description (#8096)
johncrn Oct 12, 2020
3327b7f
fix(cloudfront): compression disabled by default for Distribution (#1…
njlynch Oct 12, 2020
46df4a7
feat(apigateway): autodetermine the private integration uri (#10730)
Oct 12, 2020
99111f7
fix(lambda): grantInvoke on imported function fails (#10622)
njlynch Oct 12, 2020
c7e52ee
chore(cli): Use previous version for fetching regression tests (#10675)
iliapolo Oct 12, 2020
fa8d4ed
chore: enable gitpod prebuilds for PRs from forks (#10824)
Oct 12, 2020
e90a0a9
feat(aws-codepipeline-actions) allows custom role for code commit eve…
nirvana124 Oct 12, 2020
aebac92
feat(lambda-python): bundle dependencies in a lambda layer (#9582)
misterjoshua Oct 12, 2020
11ce726
feat(aws-ec2): vpc flow log s3 bucket prefix support (#10779)
relm923 Oct 13, 2020
33e2047
docs(apigateway): methodArn is a getter (#10822)
Oct 13, 2020
240d4b5
feat(ec2): add c5a instance class
xian13 Oct 13, 2020
5bb13ea
docs(cognito): minor README fixup (#10839)
shivlaks Oct 13, 2020
25eb1c2
feat(config): Scope class for scoping config rules to a specific reso…
shivlaks Oct 13, 2020
1fbb8bc
chore(pipelines): note that stacks aren't automatically deleted (#10843)
rix0rrr Oct 13, 2020
2cb8e22
feat(secretsmanager): hosted rotation (#10790)
jogold Oct 13, 2020
fe8d5e6
feat(cloudfront): Distribution is now in Developer Preview (#10831)
njlynch Oct 13, 2020
cf26821
feat(aws-ecs-builder): add public ip support (#10646)
misterjoshua Oct 13, 2020
346dbf4
feat(appsync): MappingTemplate.dynamoDbQuery - add ability to specify…
bryan-hunter Oct 13, 2020
ea9b15b
docs(appsync): correct spelling in resolver description (#10845)
cgarvis Oct 13, 2020
7121ffc
chore(core): consistent pluralization of Size.pebibytes (#10849)
RomainMuller Oct 13, 2020
64ee2a4
chore(config): rename scope to ruleScope and Scope to RuleScope (#10852)
shivlaks Oct 13, 2020
85738de
feat(config): convenience class with static constants for referencing…
shivlaks Oct 13, 2020
d412bb6
chore(rds): add additional postgres engine versions (#10857)
neilkuan Oct 14, 2020
bfba258
chore(rds): add additional aurora postgres engine versions (#10862)
neilkuan Oct 14, 2020
3361e5d
chore(config): private constructor for managed rule identifiers class…
shivlaks Oct 14, 2020
7cd7ed9
chore(codeguruprofiler): update module stability to experimental (#10…
shivlaks Oct 14, 2020
f4a496f
docs(config): refresh the README with more context, content, and samp…
shivlaks Oct 14, 2020
a4bab5b
chore: add 'test/' to npmignore when creating missing construct libra…
shivlaks Oct 14, 2020
f085a09
feat(events-targets): allow passing a role to the CodeBuild target (#…
newcomer Oct 14, 2020
dec8e07
fix(codebuild): add BatchPutCodeCoverages permission to Project by de…
karthikns16 Oct 14, 2020
88e1cd9
feat(config): the AWS Config Construct Library is now Generally Avail…
shivlaks Oct 14, 2020
fee5b39
chore(cfnspec): update npmignore to include '**/cdk.out' when creatin…
shivlaks Oct 14, 2020
0bb133e
feat(cfnspec): cloudformation spec v18.7.0 (#10864)
aws-cdk-automation Oct 14, 2020
5bc9709
chore(chatbot): update module stability to experimental instead of cf…
shivlaks Oct 15, 2020
95a0c0d
chore(release): 1.68.0
Oct 15, 2020
57f972f
Update breaking change
njlynch Oct 15, 2020
b2f16b3
fix(dynamodb): grantTableListStreams() permissions have incorrect Res…
ayush987goyal Oct 15, 2020
97de838
chore(release): 1.68.0 (#10882)
mergify[bot] Oct 15, 2020
eb2c568
feat(apigateway): mTLS support (#10521)
doug-ferris-mondo Oct 15, 2020
5e0cd2b
feat(ec2): t4g instances (#10817)
grusy Oct 15, 2020
25897d6
feat(eks): Support KubernetesVersion 1.18 (#10854)
pahud Oct 15, 2020
5f164af
chore: CodeBuild build errors when branch is not 'master' (#10868)
Oct 15, 2020
49ede22
feat(cognito): user pool identity support for Google (#10649)
asjadsaboor-10p Oct 15, 2020
3b25faf
chore: fix the build from moved script (#10889)
njlynch Oct 15, 2020
aae5d1d
feat(apigatewayv2): http api - metric methods for api and stage (#10686)
cyuste Oct 15, 2020
abeba23
chore(release): 1.68.0
Oct 15, 2020
02b3d9b
Update breaking change
njlynch Oct 15, 2020
60b8092
Merge remote-tracking branch 'origin/release' into bump/1.68.0
njlynch Oct 15, 2020
61e6473
chore(release): 1.68.0 (#10892)
mergify[bot] Oct 15, 2020
649c50c
chore: forward merge master onto the 'v2-main' branch (#10848)
Oct 15, 2020
a6a3f46
chore: Remove CANDIDATE_VERSION check from regression tests (#10897)
njlynch Oct 15, 2020
ce9ee50
chore(init-templates): bump up junit from 4.13 to 4.13.1 (#10860)
shivlaks Oct 15, 2020
b894e73
Merge branch 'master' into merge-back/1.68.0
mergify[bot] Oct 15, 2020
d76adbc
chore(merge-back): 1.68.0 (#10900)
mergify[bot] Oct 15, 2020
450becf
docs(lamba-event-sources): fix typos in readme (#10899)
blimmer Oct 15, 2020
3839796
chore(lambda-event-sources): fix typo in readme (#9959)
simonireilly Oct 16, 2020
895372f
feat(apigatewayv2): configure description for HttpApi (#10863)
iRoachie Oct 16, 2020
ddff369
chore: move v2 forward merge as a CodeBuild job (#10911)
Oct 16, 2020
9b2438a
fix(cli): failure if account cache is malformed (#10887)
rix0rrr Oct 16, 2020
650c23f
fix(apigateway): lambda integration does not recognize allowTestInvok…
wtho Oct 16, 2020
36fea28
docs(pipelines): add branch to GitHubSourceAction in README (#10907)
yattoni Oct 16, 2020
d943d26
chore: add "gen" target as a pre build script (#10648)
NetaNir Oct 17, 2020
2640d9a
chore(eks): relax cdk8s dependency to constructs + runtime validation…
iliapolo Oct 18, 2020
2f3a167
fix(cli): `cdk context --reset <number>` does not work (#10753)
diesal11 Oct 19, 2020
8ffabb4
feat(pipelines): temporarily disable self-mutation (#10466)
tomas-mazak Oct 19, 2020
62a2286
fix(apigateway): cannot configure stage for SpecRestApi (#10749)
alvyn279 Oct 19, 2020
ddff37c
chore: merge forward script fails when branch is already checked out …
Oct 19, 2020
fb54aad
chore(lambda): migrate all tests to jest (#10948)
Oct 19, 2020
43bc908
chore(deps): bump yargs from 16.0.3 to 16.1.0 (#10954)
dependabot-preview[bot] Oct 19, 2020
b8de264
fix(lambda-python): asset hashes changed (#10959)
misterjoshua Oct 19, 2020
10de355
chore(deps-dev): bump parcel from 2.0.0-beta.1 to 2.0.0-nightly.425 (…
dependabot-preview[bot] Oct 19, 2020
426b7db
chore(release): 1.69.0
Oct 19, 2020
2b474b9
Merge pull request #10964 from aws/bump/1.69.0
NetaNir Oct 19, 2020
5450322
chore(merge-back): 1.69.0 (#10967)
mergify[bot] Oct 20, 2020
6d04fd2
docs(stepfunctions): fix typo in README (#10939)
hilotter Oct 20, 2020
b93cda6
feat(events-targets): add support for Kinesis Firehose as a target (#…
cheruvian Oct 20, 2020
170551e
chore(deps): bump jest from 26.4.2 to 26.6.0 (#10973)
dependabot-preview[bot] Oct 20, 2020
37dc9d8
chore: add 'v2' branch prefix as a mergify conditional (#10956)
Oct 20, 2020
dd81e77
feat(cloudfront): brotli compression support (#10950)
AnderEnder Oct 20, 2020
aa3f3fd
fix(cloudfront): logging bucket uses global domain name (#10945)
njlynch Oct 20, 2020
db84223
chore(redshift): update package stability to experimental (#10983)
njlynch Oct 20, 2020
af45a1f
chore(deps-dev): bump cdk8s from 0.30.0 to 0.32.0 (#10991)
dependabot-preview[bot] Oct 20, 2020
fe6ec39
chore(deps-dev): bump @types/node from 10.17.35 to 10.17.40 (#10980)
dependabot-preview[bot] Oct 20, 2020
585920e
chore(s3): migrate tests to jest (#10934)
Chriscbr Oct 20, 2020
5c030b3
chore(deps-dev): bump parcel from 2.0.0-nightly.425 to 2.0.0-nightly.…
dependabot-preview[bot] Oct 20, 2020
6afaddc
chore(stepfunctions): fix typo in sfn docs (#11000)
skilbjo Oct 21, 2020
da57d61
docs(app-delivery): Fix URL to pipelines readme (#10985)
christophgysin Oct 21, 2020
cc2600f
chore(region-info): eu-south-1 (Milan) ROUTE_53_BUCKET_WEBSITE_ZONE_I…
PatMyron Oct 21, 2020
6956aad
feat(cloudfront-origins): move cloudfront-origins to Developer Previe…
njlynch Oct 21, 2020
191d7b7
fix(lambda-nodejs): docker build is not working (#10885)
ncaq Oct 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .github/workflows/auto-approve-v2-merge-forward.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Automatically approve PRs that merge master forward to v2-main
#
# Only does approvals! mergify takes care of the actual merge.
name: Auto-approve forward merges onto v2-main
on:
pull_request:
types:
- labeled
- opened
- ready_for_review
- reopened
- synchronize
- unlabeled
- unlocked

jobs:
approve:
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v2.0.0
if: >
github.event.pull_request.user.login == 'aws-cdk-automation'
&& github.event.pull_request.base.ref == 'v2-main'
&& contains(github.event.pull_request.labels.*.name, 'pr/forward-merge')
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ yarn-error.log
# Parcel default cache directory
.parcel-cache

# VSCode history plugin
.vscode/.history/

# Cloud9
.c9
6 changes: 6 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
github:
prebuilds:
pullRequestsFromForks: true
addComment: true

image: jsii/superchain

tasks:
- init: yarn build --skip-test --no-bail --skip-prereqs --skip-compat

Expand Down
21 changes: 21 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pull_request_rules:
commit_message: title+body
conditions:
- base!=release
- -base~=^v2
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge|no-squash|two-approvers)
- -merged
Expand All @@ -41,6 +42,7 @@ pull_request_rules:
commit_message: title+body
conditions:
- base!=release
- -base~=^v2
- -title~=(WIP|wip)
- label~=two-approvers
- -label~=(blocked|do-not-merge|no-squash)
Expand All @@ -64,6 +66,7 @@ pull_request_rules:
strict_method: merge
commit_message: title+body
conditions:
- -base~=^v2
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge)
# Only if no-squash is set
Expand Down Expand Up @@ -119,3 +122,21 @@ pull_request_rules:
- "#changes-requested-reviews-by=0"
- status-success~=AWS CodeBuild us-east-1
- status-success=validate-pr
- name: automatic merge of v2 forward merges
actions:
comment:
message: Forward merge successful!
merge:
method: merge
strict: smart+fasttrack
strict_method: merge
commit_message: title+body
conditions:
- base=v2-main
- label~=forward-merge
- -label~=(blocked|do-not-merge)
- -merged
- -closed
- author~=aws-cdk-automation
- "#approved-reviews-by>=1"
- status-success~=AWS CodeBuild us-east-1
110 changes: 110 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ you need to have the following SDKs and tools locally:
- [Node.js >= 10.13.0](https://nodejs.org/download/release/latest-v10.x/)
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
- ⚠️ versions `13.0.0` to `13.6.0` are not supported due to compatibility issues with our dependencies.
- [Yarn >= 1.19.1, < 1.3](https://yarnpkg.com/lang/en/docs/install)
- [Yarn >= 1.19.1, < 2](https://yarnpkg.com/lang/en/docs/install)
- [Java >= OpenJDK 8, 11, 14](https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
- [Apache Maven >= 3.6.0, < 4.0](http://maven.apache.org/install.html)
- [.NET Core SDK 3.1.x](https://www.microsoft.com/net/download)
- [Python >= 3.6.5, < 4.0](https://www.python.org/downloads/release/python-365/)
- [Ruby >= 2.5.1, < 3.0](https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-5-1-released/)
- [Docker 19.03](https://docs.docker.com/get-docker/)
- [Docker >= 19.03](https://docs.docker.com/get-docker/)

The basic commands to get the repository cloned and built locally follow:

Expand Down
10 changes: 5 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ done
export PATH=$(npm bin):$PATH
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}"

if ! [ -x "$(command -v yarn)" ]; then
echo "yarn is not installed. Install it from here- https://yarnpkg.com/en/docs/install."
exit 1
fi

echo "============================================================================================="
echo "installing..."
yarn install --frozen-lockfile --network-timeout 1000000
Expand Down Expand Up @@ -65,11 +70,6 @@ rm -rf $BUILD_INDICATOR
export MERKLE_BUILD_CACHE=$(mktemp -d)
trap "rm -rf $MERKLE_BUILD_CACHE" EXIT

if ! [ -x "$(command -v yarn)" ]; then
echo "yarn is not installed. Install it from here- https://yarnpkg.com/en/docs/install."
exit 1
fi

echo "============================================================================================="
echo "building..."
time lerna run $bail --stream $runtarget || fail
Expand Down
1 change: 1 addition & 0 deletions buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ phases:
- /bin/bash ./fetch-dotnet-snk.sh
build:
commands:
- 'if ${BUMP_CANDIDATE:-false}; then /bin/bash ./scripts/bump-candidate.sh; fi'
- /bin/bash ./scripts/align-version.sh
- /bin/bash ./build.sh
post_build:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"tools/*"
],
"rejectCycles": "true",
"version": "1.66.0"
"version": "1.69.0"
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@
"aws-cdk-lib/semver/**",
"aws-cdk-lib/yaml",
"aws-cdk-lib/yaml/**",
"monocdk-experiment/case",
"monocdk-experiment/case/**",
"monocdk-experiment/fs-extra",
"monocdk-experiment/fs-extra/**",
"monocdk-experiment/jsonschema",
"monocdk-experiment/jsonschema/**",
"monocdk-experiment/minimatch",
"monocdk-experiment/minimatch/**",
"monocdk-experiment/semver",
"monocdk-experiment/semver/**",
"monocdk-experiment/yaml",
"monocdk-experiment/yaml/**"
"monocdk/case",
"monocdk/case/**",
"monocdk/fs-extra",
"monocdk/fs-extra/**",
"monocdk/jsonschema",
"monocdk/jsonschema/**",
"monocdk/minimatch",
"monocdk/minimatch/**",
"monocdk/semver",
"monocdk/semver/**",
"monocdk/yaml",
"monocdk/yaml/**"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ dist
lib/generated/resources.ts
.jsii

.coverage
__pycache__

.LAST_BUILD
.nyc_output
coverage
Expand All @@ -14,4 +17,4 @@ nyc.config.js
*.snk
!.eslintrc.js

junit.xml
junit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ tsconfig.json

**/cdk.out
junit.xml

test/
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ nameDescription.add(new FireLensExtension());
nameDescription.add(new XRayExtension());
nameDescription.add(new CloudwatchAgentExtension());
nameDescription.add(new HttpLoadBalancerExtension());
nameDescription.add(new AssignPublicIpExtension());
```

## Launching the `ServiceDescription` as a `Service`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as route53 from '@aws-cdk/aws-route53';
import * as cdk from '@aws-cdk/core';
import { Service } from '../../service';
import { Container } from '../container';
import { ServiceExtension, ServiceBuild, EnvironmentCapacityType } from '../extension-interfaces';
import { TaskRecordManager } from './task-record-manager';

export interface AssignPublicIpExtensionOptions {
/**
* Enable publishing task public IPs to a recordset in a Route 53 hosted zone.
*
* Note: If you want to change the DNS zone or record name, you will need to
* remove this extension completely and then re-add it.
*/
dns?: AssignPublicIpDnsOptions;
}

export interface AssignPublicIpDnsOptions {
/**
* A DNS Zone to expose task IPs in.
*/
zone: route53.IHostedZone;

/**
* Name of the record to add to the zone and in which to add the task IP
* addresses to.
*
* @example 'myservice'
*/
recordName: string;
}

/**
* Modifies the service to assign a public ip to each task and optionally
* exposes public IPs in a Route 53 record set.
*
* Note: If you want to change the DNS zone or record name, you will need to
* remove this extension completely and then re-add it.
*/
export class AssignPublicIpExtension extends ServiceExtension {
dns?: AssignPublicIpDnsOptions;

constructor(options?: AssignPublicIpExtensionOptions) {
super('public-ip');

this.dns = options?.dns;
}

private hasDns() {
return Boolean(this.dns);
}

public prehook(service: Service, _scope: cdk.Construct) {
super.prehook(service, _scope);

if (service.capacityType != EnvironmentCapacityType.FARGATE) {
throw new Error('AssignPublicIp only supports Fargate tasks');
}
}

public modifyServiceProps(props: ServiceBuild) {
return {
...props,
assignPublicIp: true,
} as ServiceBuild;
}

public useService(service: ecs.Ec2Service | ecs.FargateService) {
if (this.hasDns()) {
new TaskRecordManager(service, 'TaskRecordManager', {
service: service,
dnsZone: this.dns!.zone,
dnsRecordName: this.dns!.recordName,
});

const container = this.parentService.serviceDescription.get('service-container') as Container;
service.connections.allowFromAnyIpv4(
ec2.Port.tcp(container.trafficPort),
'Accept inbound traffic on traffic port from anywhere',
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './assign-public-ip';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format using: yapf -ri .
# Since you're here, unit test using: python -m unittest discover
[style]
based_on_style = pep8
column_limit = 120
SPLIT_BEFORE_NAMED_ASSIGNS = False
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]
yapf = "*"
boto3 = "*"
coverage = "*"

[requires]
python_version = "3.8"
Loading