Skip to content

Commit

Permalink
Merge branch 'master' into huijbers/cdk-pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 8, 2020
2 parents be1cf0b + 84b923f commit ac15d93
Show file tree
Hide file tree
Showing 109 changed files with 3,417 additions and 346 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

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.

## [1.50.0](https://github.com/aws/aws-cdk/compare/v1.49.1...v1.50.0) (2020-07-07)


### ⚠ BREAKING CHANGES

* **eks:** `version` is now a mandatory property

### Features

* **apigatewayv2:** http api - custom domain & stage mapping ([#8027](https://github.com/aws/aws-cdk/issues/8027)) ([5e43348](https://github.com/aws/aws-cdk/commit/5e43348ecdb6a8da865bb0db22c4782b6fa4bc96)), closes [#7847](https://github.com/aws/aws-cdk/issues/7847)
* **autoscaling:** allow setting autoscaling group name ([#8853](https://github.com/aws/aws-cdk/issues/8853)) ([38d8414](https://github.com/aws/aws-cdk/commit/38d84149bae213d0e285d5192265043a8c0de1aa))
* **cfn-include:** add support for retrieving Output objects from the template ([#8821](https://github.com/aws/aws-cdk/issues/8821)) ([0b09bbb](https://github.com/aws/aws-cdk/commit/0b09bbb1d43192db71f682ff4f3ad125eb231d91)), closes [#8820](https://github.com/aws/aws-cdk/issues/8820)
* **custom-resources:** include handler log group in error messages ([#8839](https://github.com/aws/aws-cdk/issues/8839)) ([8e055d4](https://github.com/aws/aws-cdk/commit/8e055d449808f97436b92b6d6e57f8053e289653))
* **eks:** document how to add a manifest from url ([#8802](https://github.com/aws/aws-cdk/issues/8802)) ([b5acfaa](https://github.com/aws/aws-cdk/commit/b5acfaac89351ff6285acfdb36145bccca4b6b65)), closes [#8340](https://github.com/aws/aws-cdk/issues/8340)
* **eks:** support cluster version pinning ([#8889](https://github.com/aws/aws-cdk/issues/8889)) ([a732d14](https://github.com/aws/aws-cdk/commit/a732d149ff33f6958b83d539ba3429a025dcd631)), closes [#7762](https://github.com/aws/aws-cdk/issues/7762)
* **lambda:** efs filesystems ([#8602](https://github.com/aws/aws-cdk/issues/8602)) ([8529387](https://github.com/aws/aws-cdk/commit/8529387cb901fd1fea9e0ee1af1284de3ad98ce7)), closes [#8595](https://github.com/aws/aws-cdk/issues/8595)
* **lambda-nodejs:** allow jsx and tsx entry files ([#8892](https://github.com/aws/aws-cdk/issues/8892)) ([4ba20fd](https://github.com/aws/aws-cdk/commit/4ba20fd2f1579034483683995fac1e18e97a1b12))
* **s3-deployment:** prune - keep missing files on destination bucket ([#8263](https://github.com/aws/aws-cdk/issues/8263)) ([57914c7](https://github.com/aws/aws-cdk/commit/57914c7f430b69ae54c9d2d9fac4da1092b45b42)), closes [#953](https://github.com/aws/aws-cdk/issues/953)
* **stepfunctions:** stepfunctions and stepfunctions-tasks modules are now stable! ([#8912](https://github.com/aws/aws-cdk/issues/8912)) ([ae2378c](https://github.com/aws/aws-cdk/commit/ae2378cc2a537277025c9104bc43a4cc68318650)), closes [#6489](https://github.com/aws/aws-cdk/issues/6489)
* **stepfunctions-tasks:** task for invoking a Step Functions activity worker ([#8840](https://github.com/aws/aws-cdk/issues/8840)) ([021533c](https://github.com/aws/aws-cdk/commit/021533caa8f4e515299d1f0cdaadd9f625d6f64d))


### Bug Fixes

* **apigateway:** Lambda integration for imported functions ([#8870](https://github.com/aws/aws-cdk/issues/8870)) ([8420f96](https://github.com/aws/aws-cdk/commit/8420f96ffd6201656e908d6d7f61cdbbc3331cc1)), closes [#8869](https://github.com/aws/aws-cdk/issues/8869)
* **config:** cannot scope a custom rule without configurationChanges on ([#8738](https://github.com/aws/aws-cdk/issues/8738)) ([841060d](https://github.com/aws/aws-cdk/commit/841060d6adde4ea6d58e008f85cc155b8c3a3768))
* **core:** asset bundling fails with BuildKit ([#8911](https://github.com/aws/aws-cdk/issues/8911)) ([c1d4e0f](https://github.com/aws/aws-cdk/commit/c1d4e0fecbdf716eb55578ad5721a0ead4b306e2))
* **eks:** incorrect enableDockerBridge value when enabled ([#8895](https://github.com/aws/aws-cdk/issues/8895)) ([ea0552a](https://github.com/aws/aws-cdk/commit/ea0552a4378d61cffd14483896abadad7afa5a0a)), closes [#5786](https://github.com/aws/aws-cdk/issues/5786)
* **eks:** kubectl resources fail before fargate profiles are created ([#8859](https://github.com/aws/aws-cdk/issues/8859)) ([4fad9bc](https://github.com/aws/aws-cdk/commit/4fad9bcbd75702e89eea02a140aa010f8952329a)), closes [#8854](https://github.com/aws/aws-cdk/issues/8854) [#8574](https://github.com/aws/aws-cdk/issues/8574)
* **eks:** missing nodegroup identity in aws-auth after awsAuth.addMasterRole ([#8901](https://github.com/aws/aws-cdk/issues/8901)) ([a9c66f7](https://github.com/aws/aws-cdk/commit/a9c66f780b233ce3c25e12f39e3b1122636411b3)), closes [#7595](https://github.com/aws/aws-cdk/issues/7595)
* **lambda-nodejs:** maximum call stack size exceeded with relative entry file path ([#8907](https://github.com/aws/aws-cdk/issues/8907)) ([c585e18](https://github.com/aws/aws-cdk/commit/c585e1873e437341ac1b90afbe85a9cb9e6dc2d6)), closes [#8902](https://github.com/aws/aws-cdk/issues/8902)
* **rds:** proxy for db cluster fails with model validation error ([#8896](https://github.com/aws/aws-cdk/issues/8896)) ([7d47cfb](https://github.com/aws/aws-cdk/commit/7d47cfb39ba40a223ccc511e5706f471b9225c52)), closes [#8885](https://github.com/aws/aws-cdk/issues/8885) [#8476](https://github.com/aws/aws-cdk/issues/8476)

## [1.49.1](https://github.com/aws/aws-cdk/compare/v1.49.0...v1.49.1) (2020-07-02)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"tools/*"
],
"rejectCycles": "true",
"version": "1.49.1"
"version": "1.50.0"
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-apigatewayv2/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.snk
!*.d.ts
!*.js
**/cdk.out

# Coverage
coverage
Expand Down
66 changes: 66 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [Defining HTTP APIs](#defining-http-apis)
- [Cross Origin Resource Sharing (CORS)](#cross-origin-resource-sharing-cors)
- [Publishing HTTP APIs](#publishing-http-apis)
- [Custom Domain](#custom-domain)

## Introduction

Expand Down Expand Up @@ -134,3 +135,68 @@ If you omit the `stageName` will create a `$default` stage. A `$default` stage i
the API's URL - `https://{api_id}.execute-api.{region}.amazonaws.com/`.

Note that, `HttpApi` will always creates a `$default` stage, unless the `createDefaultStage` property is unset.



### Custom Domain

Custom domain names are simpler and more intuitive URLs that you can provide to your API users. Custom domain name are associated to API stages.

The code snippet below creates a custom domain and configures a default domain mapping for your API that maps the
custom domain to the `$default` stage of the API.

```ts
const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate';
const domainName = 'example.com';

const dn = new DomainName(stack, 'DN', {
domainName,
certificate: acm.Certificate.fromCertificateArn(stack, 'cert', certArn),
});

const api = new HttpApi(stack, 'HttpProxyProdApi', {
defaultIntegration: new LambdaProxyIntegration({ handler }),
// https://${dn.domainName} goes to prodApi $default stage
defaultDomainMapping: {
domainName: dn,
mappingKey: '/',
},
});
```

To associate a specifc `Stage` to a custom domain mapping -

```ts
api.addStage('beta', {
stageName: 'beta',
autoDeploy: true,
// https://${dn.domainName}/beta goes to the beta stage
domainMapping: {
domainName: dn,
mappingKey: 'beta',
},
});
```

The same domain name can be associated with stages across different `HttpApi` as so -

```ts
const apiDemo = new HttpApi(stack, 'DemoApi', {
defaultIntegration: new LambdaProxyIntegration({ handler }),
// https://${dn.domainName}/demo goes to apiDemo $default stage
defaultDomainMapping: {
domainName: dn,
mappingKey: 'demo',
},
});
```

The `mappingKey` determines the `path` of the URL with the custom domain. Each custom domain is only allowed
to have one API mapping with the root(/) `mappingKey`. In the sample above, the custom domain is associated
with 3 API mapping resources across different APIs and Stages.

| API | Stage | URL |
| :------------: | :---------: | :----: |
| api | $default | `https://${domainName}` |
| api | beta | `https://${domainName}/beta` |
| apiDemo | $default | `https://${domainName}/demo` |
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/lib/common/api-mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IResource } from '@aws-cdk/core';

/**
* Represents an ApiGatewayV2 ApiMapping resource
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-apimapping.html
*/
export interface IApiMapping extends IResource {
/**
* ID of the api mapping
* @attribute
*/
readonly apiMappingId: string;
}
117 changes: 117 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { ICertificate } from '@aws-cdk/aws-certificatemanager';
import { Construct, IResource, Resource, Token } from '@aws-cdk/core';
import { CfnDomainName, CfnDomainNameProps } from '../apigatewayv2.generated';

/**
* Represents an APIGatewayV2 DomainName
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-domainname.html
*/
export interface IDomainName extends IResource {
/**
* The custom domain name
*
* @attribute
*
*/
readonly domainName: string;

/**
* The domain name associated with the regional endpoint for this custom domain name.
*
* @attribute
*/
readonly regionalDomainName: string;

/**
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint.
*
* @attribute
*/
readonly regionalHostedZoneId: string;
}

/**
* custom domain name attributes
*/
export interface DomainNameAttributes {
/**
* domain name string
*/
readonly domainName: string;

/**
* The domain name associated with the regional endpoint for this custom domain name.
*/
readonly regionalDomainName: string;

/**
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint.
*/
readonly regionalHostedZoneId: string;
}

/**
* properties used for creating the DomainName
*/
export interface DomainNameProps {
/**
* The custom domain name
*/
readonly domainName: string;
/**
* The ACM certificate for this domain name
*/
readonly certificate: ICertificate;
}

/**
* Custom domain resource for the API
*/
export class DomainName extends Resource implements IDomainName {
/**
* import from attributes
*/
public static fromDomainNameAttributes(scope: Construct, id: string, attrs: DomainNameAttributes): IDomainName {
class Import extends Resource implements IDomainName {
public readonly regionalDomainName = attrs.regionalDomainName;
public readonly regionalHostedZoneId = attrs.regionalHostedZoneId;
public readonly domainName = attrs.domainName;
}
return new Import(scope, id);
}

/**
* The custom domain name for your API in Amazon API Gateway.
*
* @attribute
*/
public readonly domainName: string;

/**
* The domain name associated with the regional endpoint for this custom domain name.
*/
public readonly regionalDomainName: string;

/**
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint.
*/
public readonly regionalHostedZoneId: string;

constructor(scope: Construct, id: string, props: DomainNameProps) {
super(scope, id);

const domainNameProps: CfnDomainNameProps = {
domainName: props.domainName,
domainNameConfigurations: [
{
certificateArn: props.certificate.certificateArn,
endpointType: 'REGIONAL',
},
],
};
const resource = new CfnDomainName(this, 'Resource', domainNameProps);
this.domainName = props.domainName ?? resource.ref;
this.regionalDomainName = Token.asString(resource.getAtt('RegionalDomainName'));
this.regionalHostedZoneId = Token.asString(resource.getAtt('RegionalHostedZoneId'));
}
}
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './integration';
export * from './route';
export * from './stage';
export * from './stage';
export * from './domain-name';
export * from './api-mapping';
78 changes: 78 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Construct, Resource } from '@aws-cdk/core';
import { CfnApiMapping, CfnApiMappingProps } from '../apigatewayv2.generated';
import { IApiMapping, IDomainName } from '../common';
import { IHttpApi } from '../http/api';
import { IHttpStage } from './stage';

/**
* Properties used to create the HttpApiMapping resource
*/
export interface HttpApiMappingProps {
/**
* Api mapping key. The path where this stage should be mapped to on the domain
* @default '/'
*/
readonly apiMappingKey?: string;

/**
* The HttpApi to which this mapping is applied
*/
readonly api: IHttpApi;

/**
* custom domain name of the mapping target
*/
readonly domainName: IDomainName;

/**
* stage for the HttpApiMapping resource
*
* @default - the $default stage
*/
readonly stage?: IHttpStage;
}

/**
* The attributes used to import existing HttpApiMapping
*/
export interface HttpApiMappingAttributes {
/**
* The API mapping ID
*/
readonly apiMappingId: string;
}

/**
* Create a new API mapping for API Gateway HTTP API endpoint.
* @resource AWS::ApiGatewayV2::ApiMapping
*/
export class HttpApiMapping extends Resource implements IApiMapping {
/**
* import from API ID
*/
public static fromHttpApiMappingAttributes(scope: Construct, id: string, attrs: HttpApiMappingAttributes): IApiMapping {
class Import extends Resource implements IApiMapping {
public readonly apiMappingId = attrs.apiMappingId;
}
return new Import(scope, id);
}
/**
* ID of the API Mapping
*/
public readonly apiMappingId: string;

constructor(scope: Construct, id: string, props: HttpApiMappingProps) {
super(scope, id);

const apiMappingProps: CfnApiMappingProps = {
apiId: props.api.httpApiId,
domainName: props.domainName.domainName,
stage: props.stage?.stageName ?? '$default',
apiMappingKey: props.apiMappingKey,
};

const resource = new CfnApiMapping(this, 'Resource', apiMappingProps);
this.apiMappingId = resource.ref;
}

}
Loading

0 comments on commit ac15d93

Please sign in to comment.