@guardian/cdk 50.1.0 → 50.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants/fastly-aws-account-id.d.ts +8 -0
- package/lib/constants/fastly-aws-account-id.d.ts.map +1 -0
- package/lib/constants/fastly-aws-account-id.js +11 -0
- package/lib/constants/fastly-aws-account-id.js.map +1 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.d.ts.map +1 -1
- package/lib/constants/index.js +1 -0
- package/lib/constants/index.js.map +1 -1
- package/lib/constants/ssm-parameter-paths.d.ts +1 -0
- package/lib/constants/ssm-parameter-paths.d.ts.map +1 -1
- package/lib/constants/ssm-parameter-paths.js +4 -0
- package/lib/constants/ssm-parameter-paths.js.map +1 -1
- package/lib/constructs/iam/fastly-logs-iam.d.ts.map +1 -1
- package/lib/constructs/iam/fastly-logs-iam.js +2 -4
- package/lib/constructs/iam/fastly-logs-iam.js.map +1 -1
- package/lib/experimental/constructs/iam/index.d.ts +2 -0
- package/lib/experimental/constructs/iam/index.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/index.js +18 -0
- package/lib/experimental/constructs/iam/index.js.map +1 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts +26 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js +34 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js.map +1 -0
- package/lib/experimental/constructs/iam/roles/index.d.ts +2 -0
- package/lib/experimental/constructs/iam/roles/index.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/roles/index.js +18 -0
- package/lib/experimental/constructs/iam/roles/index.js.map +1 -0
- package/lib/experimental/constructs/policies/index.d.ts +2 -0
- package/lib/experimental/constructs/policies/index.d.ts.map +1 -0
- package/lib/experimental/constructs/policies/index.js +18 -0
- package/lib/experimental/constructs/policies/index.js.map +1 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.d.ts +11 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.d.ts.map +1 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.js +12 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.js.map +1 -0
- package/lib/patterns/api-lambda.d.ts.map +1 -1
- package/lib/patterns/api-lambda.js.map +1 -1
- package/lib/patterns/api-multiple-lambdas.d.ts +16 -12
- package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -1
- package/lib/patterns/api-multiple-lambdas.js.map +1 -1
- package/lib/patterns/ec2-app/base.d.ts.map +1 -1
- package/lib/patterns/ec2-app/base.js +0 -1
- package/lib/patterns/ec2-app/base.js.map +1 -1
- package/lib/patterns/scheduled-ecs-task.d.ts +8 -27
- package/lib/patterns/scheduled-ecs-task.d.ts.map +1 -1
- package/lib/patterns/scheduled-ecs-task.js.map +1 -1
- package/lib/patterns/scheduled-lambda.d.ts +17 -44
- package/lib/patterns/scheduled-lambda.d.ts.map +1 -1
- package/lib/patterns/scheduled-lambda.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fastly's AWS account ID.
|
|
3
|
+
* This is needed by IAM roles assumed by Fastly in order to write into
|
|
4
|
+
* an S3 bucket or a Kinesis stream.
|
|
5
|
+
* See https://docs.fastly.com/en/guides/creating-an-aws-iam-role-for-fastly-logging
|
|
6
|
+
*/
|
|
7
|
+
export declare const FASTLY_AWS_ACCOUNT_ID = "717331877981";
|
|
8
|
+
//# sourceMappingURL=fastly-aws-account-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastly-aws-account-id.d.ts","sourceRoot":"","sources":["../../src/constants/fastly-aws-account-id.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FASTLY_AWS_ACCOUNT_ID = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Fastly's AWS account ID.
|
|
6
|
+
* This is needed by IAM roles assumed by Fastly in order to write into
|
|
7
|
+
* an S3 bucket or a Kinesis stream.
|
|
8
|
+
* See https://docs.fastly.com/en/guides/creating-an-aws-iam-role-for-fastly-logging
|
|
9
|
+
*/
|
|
10
|
+
exports.FASTLY_AWS_ACCOUNT_ID = "717331877981";
|
|
11
|
+
//# sourceMappingURL=fastly-aws-account-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastly-aws-account-id.js","sourceRoot":"","sources":["../../src/constants/fastly-aws-account-id.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,cAAc,CAAC","sourcesContent":["/**\n * Fastly's AWS account ID.\n * This is needed by IAM roles assumed by Fastly in order to write into\n * an S3 bucket or a Kinesis stream.\n * See https://docs.fastly.com/en/guides/creating-an-aws-iam-role-for-fastly-logging\n */\nexport const FASTLY_AWS_ACCOUNT_ID = \"717331877981\";\n"]}
|
package/lib/constants/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
|
package/lib/constants/index.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./regex-pattern"), exports);
|
|
|
21
21
|
__exportStar(require("./ssm-parameter-paths"), exports);
|
|
22
22
|
__exportStar(require("./metadata-keys"), exports);
|
|
23
23
|
__exportStar(require("./tracking-tag"), exports);
|
|
24
|
+
__exportStar(require("./fastly-aws-account-id"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,wDAAsC;AACtC,kDAAgC;AAChC,iDAA+B","sourcesContent":["export * from \"./access\";\nexport * from \"./context-keys\";\nexport * from \"./library-info\";\nexport * from \"./regex-pattern\";\nexport * from \"./ssm-parameter-paths\";\nexport * from \"./metadata-keys\";\nexport * from \"./tracking-tag\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,wDAAsC;AACtC,kDAAgC;AAChC,iDAA+B;AAC/B,0DAAwC","sourcesContent":["export * from \"./access\";\nexport * from \"./context-keys\";\nexport * from \"./library-info\";\nexport * from \"./regex-pattern\";\nexport * from \"./ssm-parameter-paths\";\nexport * from \"./metadata-keys\";\nexport * from \"./tracking-tag\";\nexport * from \"./fastly-aws-account-id\";\n"]}
|
|
@@ -15,6 +15,7 @@ interface NamedSsmParameterPaths {
|
|
|
15
15
|
PrimaryVpcPublicSubnets: SsmParameterPath;
|
|
16
16
|
FastlyCustomerId: SsmParameterPath;
|
|
17
17
|
OrganisationDistributionBucket: SsmParameterPath;
|
|
18
|
+
DeployToolsAccountId: SsmParameterPath;
|
|
18
19
|
}
|
|
19
20
|
export declare const VPC_SSM_PARAMETER_PREFIX = "/account/vpc";
|
|
20
21
|
export declare const NAMED_SSM_PARAMETER_PATHS: NamedSsmParameterPaths;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssm-parameter-paths.d.ts","sourceRoot":"","sources":["../../src/constants/ssm-parameter-paths.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,wBAAwB,EAAE,gBAAgB,CAAC;IAC3C,uBAAuB,EAAE,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,8BAA8B,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ssm-parameter-paths.d.ts","sourceRoot":"","sources":["../../src/constants/ssm-parameter-paths.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,mBAAmB,EAAE,gBAAgB,CAAC;IACtC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,wBAAwB,EAAE,gBAAgB,CAAC;IAC3C,uBAAuB,EAAE,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,8BAA8B,EAAE,gBAAgB,CAAC;IACjD,oBAAoB,EAAE,gBAAgB,CAAC;CACxC;AAED,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,EAAE,sBAkDvC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,EAE/B,CAAC"}
|
|
@@ -47,6 +47,10 @@ exports.NAMED_SSM_PARAMETER_PATHS = {
|
|
|
47
47
|
description: "SSM parameter containing the Fastly Customer ID. Can be obtained from https://manage.fastly.com/account/company by an admin",
|
|
48
48
|
optional: true,
|
|
49
49
|
},
|
|
50
|
+
DeployToolsAccountId: {
|
|
51
|
+
path: "/organisation/accounts/deployTools",
|
|
52
|
+
description: "Account ID of the Deploy Tools account. Useful as some shared resources live here.",
|
|
53
|
+
},
|
|
50
54
|
};
|
|
51
55
|
exports.ALL_SSM_PARAMETER_PATHS = Object.values(exports.NAMED_SSM_PARAMETER_PATHS);
|
|
52
56
|
//# sourceMappingURL=ssm-parameter-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssm-parameter-paths.js","sourceRoot":"","sources":["../../src/constants/ssm-parameter-paths.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ssm-parameter-paths.js","sourceRoot":"","sources":["../../src/constants/ssm-parameter-paths.ts"],"names":[],"mappings":";;;AAwBa,QAAA,wBAAwB,GAAG,cAAc,CAAC;AAE1C,QAAA,yBAAyB,GAA2B;IAC/D,WAAW,EAAE;QACX,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EAAE,+DAA+D;QAC5E,QAAQ,EAAE,IAAI;KACf;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,uCAAuC;QAC7C,WAAW,EAAE,mEAAmE;KACjF;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,mCAAmC;QACzC,WAAW,EAAE,4EAA4E;QACzF,aAAa,EAAE,2BAA2B;KAC3C;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EAAE,qCAAqC;KACnD;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,yCAAyC;QAC/C,WAAW,EAAE,qFAAqF;QAClG,aAAa,EAAE,yBAAyB;KACzC;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,GAAG,gCAAwB,aAAa;QAC9C,WAAW,EAAE,2FAA2F;KACzG;IACD,wBAAwB,EAAE;QACxB,IAAI,EAAE,GAAG,gCAAwB,0BAA0B;QAC3D,WAAW,EAAE,2CAA2C;KACzD;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,GAAG,gCAAwB,yBAAyB;QAC1D,WAAW,EAAE,0CAA0C;KACxD;IACD,8BAA8B,EAAE;QAC9B,IAAI,EAAE,wCAAwC;QAC9C,WAAW,EAAE,uFAAuF;KACrG;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,sCAAsC;QAC5C,WAAW,EACT,6HAA6H;QAC/H,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,oCAAoC;QAC1C,WAAW,EAAE,oFAAoF;KAClG;CACF,CAAC;AAEW,QAAA,uBAAuB,GAAuB,MAAM,CAAC,MAAM,CACtE,iCAAyB,CACJ,CAAC","sourcesContent":["export interface SsmParameterPath {\n path: string;\n description: string;\n optional?: boolean;\n\n // Recommended naming convention for target resource, such as an S3 bucket.\n // $account is substituted as the account name.\n namingPattern?: string;\n}\n\ninterface NamedSsmParameterPaths {\n Anghammarad: SsmParameterPath;\n LoggingStreamName: SsmParameterPath;\n DistributionBucket: SsmParameterPath;\n AccessLoggingBucket: SsmParameterPath;\n ConfigurationBucket: SsmParameterPath;\n PrimaryVpcId: SsmParameterPath;\n PrimaryVpcPrivateSubnets: SsmParameterPath;\n PrimaryVpcPublicSubnets: SsmParameterPath;\n FastlyCustomerId: SsmParameterPath;\n OrganisationDistributionBucket: SsmParameterPath;\n DeployToolsAccountId: SsmParameterPath;\n}\n\nexport const VPC_SSM_PARAMETER_PREFIX = \"/account/vpc\";\n\nexport const NAMED_SSM_PARAMETER_PATHS: NamedSsmParameterPaths = {\n Anghammarad: {\n path: \"/account/services/anghammarad.topic.arn\",\n description: \"SSM parameter containing the ARN of the Anghammarad SNS topic\",\n optional: true,\n },\n LoggingStreamName: {\n path: \"/account/services/logging.stream.name\",\n description: \"SSM parameter containing the Name (not ARN) on the kinesis stream\",\n },\n DistributionBucket: {\n path: \"/account/services/artifact.bucket\",\n description: \"SSM parameter containing the S3 bucket name holding distribution artifacts\",\n namingPattern: \"com-gu-$account-artifacts\",\n },\n AccessLoggingBucket: {\n path: \"/account/services/access-logging/bucket\",\n description: \"S3 bucket to store your access logs\",\n },\n ConfigurationBucket: {\n path: \"/account/services/private.config.bucket\",\n description: \"SSM parameter containing the S3 bucket name holding the app's private configuration\",\n namingPattern: \"com-gu-$account-configs\",\n },\n PrimaryVpcId: {\n path: `${VPC_SSM_PARAMETER_PREFIX}/primary/id`,\n description: \"Virtual Private Cloud to run EC2 instances within. Should NOT be the account default VPC.\",\n },\n PrimaryVpcPrivateSubnets: {\n path: `${VPC_SSM_PARAMETER_PREFIX}/primary/subnets/private`,\n description: \"A comma-separated list of private subnets\",\n },\n PrimaryVpcPublicSubnets: {\n path: `${VPC_SSM_PARAMETER_PREFIX}/primary/subnets/public`,\n description: \"A comma-separated list of public subnets\",\n },\n OrganisationDistributionBucket: {\n path: \"/organisation/services/artifact.bucket\",\n description: \"SSM parameter containing the S3 bucket name holding organisation-level DevX artifacts\",\n },\n FastlyCustomerId: {\n path: \"/account/external/fastly/customer.id\",\n description:\n \"SSM parameter containing the Fastly Customer ID. Can be obtained from https://manage.fastly.com/account/company by an admin\",\n optional: true,\n },\n DeployToolsAccountId: {\n path: \"/organisation/accounts/deployTools\",\n description: \"Account ID of the Deploy Tools account. Useful as some shared resources live here.\",\n },\n};\n\nexport const ALL_SSM_PARAMETER_PATHS: SsmParameterPath[] = Object.values(\n NAMED_SSM_PARAMETER_PATHS\n) as SsmParameterPath[];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastly-logs-iam.d.ts","sourceRoot":"","sources":["../../../src/constructs/iam/fastly-logs-iam.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastly-logs-iam.d.ts","sourceRoot":"","sources":["../../../src/constructs/iam/fastly-logs-iam.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,mBAAoB,SAAQ,MAAM;gBACjC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,wBAAwB;CAc5D"}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuFastlyLogsIamRole = void 0;
|
|
4
4
|
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
5
|
+
const fastly_aws_account_id_1 = require("../../constants/fastly-aws-account-id");
|
|
5
6
|
const core_1 = require("../core");
|
|
6
7
|
const policies_1 = require("./policies");
|
|
7
8
|
const roles_1 = require("./roles");
|
|
8
|
-
// Fastly's AWS account ID is used as an external ID when creating the IAM role
|
|
9
|
-
// See https://docs.fastly.com/en/guides/creating-an-aws-iam-role-for-fastly-logging
|
|
10
|
-
const FASTLY_AWS_ACCOUNT_ID = "717331877981";
|
|
11
9
|
/**
|
|
12
10
|
* Construct which creates the required IAM resources to support Fastly logging to an S3 bucket.
|
|
13
11
|
* Importantly, it does not create a permanent IAM user, which was once a requirement.
|
|
@@ -33,7 +31,7 @@ class GuFastlyLogsIamRole extends roles_1.GuRole {
|
|
|
33
31
|
const { path = "*" } = props; // set defaults
|
|
34
32
|
const fastlyCustomerId = core_1.GuFastlyCustomerIdParameter.getInstance(scope).valueAsString;
|
|
35
33
|
super(scope, "GuFastlyLogsIamRole", {
|
|
36
|
-
assumedBy: new aws_iam_1.AccountPrincipal(FASTLY_AWS_ACCOUNT_ID),
|
|
34
|
+
assumedBy: new aws_iam_1.AccountPrincipal(fastly_aws_account_id_1.FASTLY_AWS_ACCOUNT_ID),
|
|
37
35
|
externalIds: [fastlyCustomerId],
|
|
38
36
|
});
|
|
39
37
|
const policy = new policies_1.GuPutS3ObjectsPolicy(scope, "GuFastlyLogsIamRolePolicy", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastly-logs-iam.js","sourceRoot":"","sources":["../../../src/constructs/iam/fastly-logs-iam.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;
|
|
1
|
+
{"version":3,"file":"fastly-logs-iam.js","sourceRoot":"","sources":["../../../src/constructs/iam/fastly-logs-iam.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;AACvD,iFAA8E;AAE9E,kCAAsD;AACtD,yCAAkD;AAClD,mCAAiC;AAejC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,mBAAoB,SAAQ,cAAM;IAC7C,YAAY,KAAc,EAAE,KAA+B;QACzD,MAAM,EAAE,IAAI,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,eAAe;QAC7C,MAAM,gBAAgB,GAAG,kCAA2B,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;QACtF,KAAK,CAAC,KAAK,EAAE,qBAAqB,EAAE;YAClC,SAAS,EAAE,IAAI,0BAAgB,CAAC,6CAAqB,CAAC;YACtD,WAAW,EAAE,CAAC,gBAAgB,CAAC;SAChC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,+BAAoB,CAAC,KAAK,EAAE,2BAA2B,EAAE;YAC1E,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,KAAK,EAAE,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AAfD,kDAeC","sourcesContent":["import { AccountPrincipal } from \"aws-cdk-lib/aws-iam\";\nimport { FASTLY_AWS_ACCOUNT_ID } from \"../../constants/fastly-aws-account-id\";\nimport type { GuStack } from \"../core\";\nimport { GuFastlyCustomerIdParameter } from \"../core\";\nimport { GuPutS3ObjectsPolicy } from \"./policies\";\nimport { GuRole } from \"./roles\";\n\nexport interface GuFastlyLogsIamRoleProps {\n /**\n * S3 bucket name that Fastly will ship logs\n */\n bucketName: string;\n /**\n * Path within the S3 bucket where Fastly will ship logs.\n * @default - '*'\n * If path is not specified, access will be granted to the entire S3 bucket.\n */\n path?: string;\n}\n\n/**\n * Construct which creates the required IAM resources to support Fastly logging to an S3 bucket.\n * Importantly, it does not create a permanent IAM user, which was once a requirement.\n *\n * Specifically, this construct creates a role which can only be assumed in Fastly's AWS account,\n * with an attached policy allowing PUT access to an S3 bucket and path specified in the props.\n *\n * As mentioned, you should configure the S3 bucket used with `bucketName` and the path within\n * that bucket with the optional `path`. `path` defaults to `\"*\"` i.e. access is given to the\n * entire bucket.\n *\n * ```typescript\n * new GuFastlyLogsIamRole(stack, {\n * bucketName: \"gu-mobile-logs\"\n * path: \"fastly/*\"\n * })\n * ```\n *\n * See https://docs.fastly.com/en/guides/creating-an-aws-iam-role-for-fastly-logging\n */\nexport class GuFastlyLogsIamRole extends GuRole {\n constructor(scope: GuStack, props: GuFastlyLogsIamRoleProps) {\n const { path = \"*\" } = props; // set defaults\n const fastlyCustomerId = GuFastlyCustomerIdParameter.getInstance(scope).valueAsString;\n super(scope, \"GuFastlyLogsIamRole\", {\n assumedBy: new AccountPrincipal(FASTLY_AWS_ACCOUNT_ID),\n externalIds: [fastlyCustomerId],\n });\n const policy = new GuPutS3ObjectsPolicy(scope, \"GuFastlyLogsIamRolePolicy\", {\n bucketName: props.bucketName,\n paths: [path],\n });\n\n policy.attachToRole(this);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/constructs/iam/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./roles"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/experimental/constructs/iam/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from \"./roles\";\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GuStack } from "../../../../constructs/core";
|
|
2
|
+
import { GuRole } from "../../../../constructs/iam";
|
|
3
|
+
import type { GuKinesisStream } from "../../../../constructs/kinesis";
|
|
4
|
+
export interface GuFastlyKinesisLogRoleProps {
|
|
5
|
+
/**
|
|
6
|
+
* The Kinesis stream into which Fastly will put records
|
|
7
|
+
*/
|
|
8
|
+
stream: GuKinesisStream;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the IAM role
|
|
11
|
+
*/
|
|
12
|
+
roleName?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A construct to create an IAM Role for Fastly to assume in order to write to a
|
|
16
|
+
* specific Kinesis stream.
|
|
17
|
+
*
|
|
18
|
+
* In order to use this construct, an SSM parameter named `/account/external/fastly/customer.id`
|
|
19
|
+
* needs to exist in the AWS account's parameter store, and the value should be
|
|
20
|
+
* the Guardian's Fastly customer id.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare class GuFastlyKinesisLogRoleExperimental extends GuRole {
|
|
24
|
+
constructor(scope: GuStack, id: string, props: GuFastlyKinesisLogRoleProps);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=fastly-kinesis-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastly-kinesis-log.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/constructs/iam/roles/fastly-kinesis-log.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,qBAAa,kCAAmC,SAAQ,MAAM;gBAChD,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,2BAA2B;CAgB3E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuFastlyKinesisLogRoleExperimental = void 0;
|
|
4
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
5
|
+
const fastly_aws_account_id_1 = require("../../../../constants/fastly-aws-account-id");
|
|
6
|
+
const core_1 = require("../../../../constructs/core");
|
|
7
|
+
const iam_1 = require("../../../../constructs/iam");
|
|
8
|
+
const kinesis_put_records_1 = require("../../policies/kinesis-put-records");
|
|
9
|
+
/**
|
|
10
|
+
* A construct to create an IAM Role for Fastly to assume in order to write to a
|
|
11
|
+
* specific Kinesis stream.
|
|
12
|
+
*
|
|
13
|
+
* In order to use this construct, an SSM parameter named `/account/external/fastly/customer.id`
|
|
14
|
+
* needs to exist in the AWS account's parameter store, and the value should be
|
|
15
|
+
* the Guardian's Fastly customer id.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
class GuFastlyKinesisLogRoleExperimental extends iam_1.GuRole {
|
|
19
|
+
constructor(scope, id, props) {
|
|
20
|
+
const fastlyCustomerId = core_1.GuFastlyCustomerIdParameter.getInstance(scope).valueAsString;
|
|
21
|
+
const { roleName, stream } = props;
|
|
22
|
+
super(scope, id, {
|
|
23
|
+
roleName,
|
|
24
|
+
assumedBy: new aws_iam_1.AccountPrincipal(fastly_aws_account_id_1.FASTLY_AWS_ACCOUNT_ID),
|
|
25
|
+
externalIds: [fastlyCustomerId],
|
|
26
|
+
});
|
|
27
|
+
const policy = new kinesis_put_records_1.GuKinesisPutRecordsPolicyExperimental(scope, "GuKinesisPutRecordsPolicy", {
|
|
28
|
+
stream,
|
|
29
|
+
});
|
|
30
|
+
policy.attachToRole(this);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GuFastlyKinesisLogRoleExperimental = GuFastlyKinesisLogRoleExperimental;
|
|
34
|
+
//# sourceMappingURL=fastly-kinesis-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastly-kinesis-log.js","sourceRoot":"","sources":["../../../../../src/experimental/constructs/iam/roles/fastly-kinesis-log.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;AACvD,uFAAoF;AAEpF,sDAA0E;AAC1E,oDAAoD;AAEpD,4EAA2F;AAa3F;;;;;;;;GAQG;AACH,MAAa,kCAAmC,SAAQ,YAAM;IAC5D,YAAY,KAAc,EAAE,EAAU,EAAE,KAAkC;QACxE,MAAM,gBAAgB,GAAG,kCAA2B,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;QACtF,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEnC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,QAAQ;YACR,SAAS,EAAE,IAAI,0BAAgB,CAAC,6CAAqB,CAAC;YACtD,WAAW,EAAE,CAAC,gBAAgB,CAAC;SAChC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,2DAAqC,CAAC,KAAK,EAAE,2BAA2B,EAAE;YAC3F,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AAjBD,gFAiBC","sourcesContent":["import { AccountPrincipal } from \"aws-cdk-lib/aws-iam\";\nimport { FASTLY_AWS_ACCOUNT_ID } from \"../../../../constants/fastly-aws-account-id\";\nimport type { GuStack } from \"../../../../constructs/core\";\nimport { GuFastlyCustomerIdParameter } from \"../../../../constructs/core\";\nimport { GuRole } from \"../../../../constructs/iam\";\nimport type { GuKinesisStream } from \"../../../../constructs/kinesis\";\nimport { GuKinesisPutRecordsPolicyExperimental } from \"../../policies/kinesis-put-records\";\n\nexport interface GuFastlyKinesisLogRoleProps {\n /**\n * The Kinesis stream into which Fastly will put records\n */\n stream: GuKinesisStream;\n /**\n * Name of the IAM role\n */\n roleName?: string;\n}\n\n/**\n * A construct to create an IAM Role for Fastly to assume in order to write to a\n * specific Kinesis stream.\n *\n * In order to use this construct, an SSM parameter named `/account/external/fastly/customer.id`\n * needs to exist in the AWS account's parameter store, and the value should be\n * the Guardian's Fastly customer id.\n *\n */\nexport class GuFastlyKinesisLogRoleExperimental extends GuRole {\n constructor(scope: GuStack, id: string, props: GuFastlyKinesisLogRoleProps) {\n const fastlyCustomerId = GuFastlyCustomerIdParameter.getInstance(scope).valueAsString;\n const { roleName, stream } = props;\n\n super(scope, id, {\n roleName,\n assumedBy: new AccountPrincipal(FASTLY_AWS_ACCOUNT_ID),\n externalIds: [fastlyCustomerId],\n });\n\n const policy = new GuKinesisPutRecordsPolicyExperimental(scope, \"GuKinesisPutRecordsPolicy\", {\n stream,\n });\n\n policy.attachToRole(this);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/constructs/iam/roles/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fastly-kinesis-log"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/experimental/constructs/iam/roles/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./fastly-kinesis-log\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/constructs/policies/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./kinesis-put-records"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/experimental/constructs/policies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC","sourcesContent":["export * from \"./kinesis-put-records\";\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GuStack } from "../../../constructs/core";
|
|
2
|
+
import type { GuNoStatementsPolicyProps } from "../../../constructs/iam/policies/base-policy";
|
|
3
|
+
import { GuAllowPolicy } from "../../../constructs/iam/policies/base-policy";
|
|
4
|
+
import type { GuKinesisStream } from "../../../constructs/kinesis";
|
|
5
|
+
export interface GuKinesisPutRecordsPolicyProps extends GuNoStatementsPolicyProps {
|
|
6
|
+
stream: GuKinesisStream;
|
|
7
|
+
}
|
|
8
|
+
export declare class GuKinesisPutRecordsPolicyExperimental extends GuAllowPolicy {
|
|
9
|
+
constructor(scope: GuStack, id: string, props: GuKinesisPutRecordsPolicyProps);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=kinesis-put-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinesis-put-records.d.ts","sourceRoot":"","sources":["../../../../src/experimental/constructs/policies/kinesis-put-records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,WAAW,8BAA+B,SAAQ,yBAAyB;IAC/E,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,qBAAa,qCAAsC,SAAQ,aAAa;gBAC1D,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;CAI9E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuKinesisPutRecordsPolicyExperimental = void 0;
|
|
4
|
+
const base_policy_1 = require("../../../constructs/iam/policies/base-policy");
|
|
5
|
+
class GuKinesisPutRecordsPolicyExperimental extends base_policy_1.GuAllowPolicy {
|
|
6
|
+
constructor(scope, id, props) {
|
|
7
|
+
const { stream } = props;
|
|
8
|
+
super(scope, id, { actions: ["kinesis:PutRecords", "kinesis:ListShards"], resources: [stream.streamArn] });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.GuKinesisPutRecordsPolicyExperimental = GuKinesisPutRecordsPolicyExperimental;
|
|
12
|
+
//# sourceMappingURL=kinesis-put-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinesis-put-records.js","sourceRoot":"","sources":["../../../../src/experimental/constructs/policies/kinesis-put-records.ts"],"names":[],"mappings":";;;AAEA,8EAA6E;AAO7E,MAAa,qCAAsC,SAAQ,2BAAa;IACtE,YAAY,KAAc,EAAE,EAAU,EAAE,KAAqC;QAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QACzB,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7G,CAAC;CACF;AALD,sFAKC","sourcesContent":["import type { GuStack } from \"../../../constructs/core\";\nimport type { GuNoStatementsPolicyProps } from \"../../../constructs/iam/policies/base-policy\";\nimport { GuAllowPolicy } from \"../../../constructs/iam/policies/base-policy\";\nimport type { GuKinesisStream } from \"../../../constructs/kinesis\";\n\nexport interface GuKinesisPutRecordsPolicyProps extends GuNoStatementsPolicyProps {\n stream: GuKinesisStream;\n}\n\nexport class GuKinesisPutRecordsPolicyExperimental extends GuAllowPolicy {\n constructor(scope: GuStack, id: string, props: GuKinesisPutRecordsPolicyProps) {\n const { stream } = props;\n super(scope, id, { actions: [\"kinesis:PutRecords\", \"kinesis:ListShards\"], resources: [stream.streamArn] });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-lambda.d.ts","sourceRoot":"","sources":["../../src/patterns/api-lambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,QAAS,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;IAC5D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,2BAA2B,CAAC;IAC1F;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"api-lambda.d.ts","sourceRoot":"","sources":["../../src/patterns/api-lambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,QAAS,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;IAC5D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,2BAA2B,CAAC;IAC1F;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAC;IACd;;;;;;;OAOG;IACH,uBAAuB,EAAE,YAAY,GAAG,gBAAgB,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,WAAY,SAAQ,gBAAgB;IAC/C,SAAgB,GAAG,EAAE,aAAa,CAAC;gBAEvB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;CAuBhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-lambda.js","sourceRoot":"","sources":["../../src/patterns/api-lambda.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAG3D,oFAA6F;AAE7F,iDAAwD;
|
|
1
|
+
{"version":3,"file":"api-lambda.js","sourceRoot":"","sources":["../../src/patterns/api-lambda.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAG3D,oFAA6F;AAE7F,iDAAwD;AAwBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,WAAY,SAAQ,yBAAgB;IAG/C,YAAY,KAAc,EAAE,EAAU,EAAE,KAAuB;QAC7D,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,GAAG,KAAK;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,GAAG,IAAI,8BAAa,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE;YAC/C,OAAO,EAAE,IAAI;YAEb,4FAA4F;YAC5F,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE;YAE5D,GAAG,KAAK,CAAC,GAAG;SACb,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,YAAY,EAAE;YAC/C,IAAI,mDAA8B,CAAC,KAAK,EAAE;gBACxC,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,kBAAkB,EAAE,IAAI,CAAC,GAAG;gBAC5B,YAAY,EAAE,KAAK,CAAC,uBAAuB,CAAC,YAAY;gBACxD,GAAG,KAAK,CAAC,uBAAuB,CAAC,YAAY;aAC9C,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA1BD,kCA0BC","sourcesContent":["import { LambdaRestApi } from \"aws-cdk-lib/aws-apigateway\";\nimport type { LambdaRestApiProps } from \"aws-cdk-lib/aws-apigateway\";\nimport type { NoMonitoring } from \"../constructs/cloudwatch\";\nimport { GuApiGateway5xxPercentageAlarm } from \"../constructs/cloudwatch/api-gateway-alarms\";\nimport type { GuStack } from \"../constructs/core\";\nimport { GuLambdaFunction } from \"../constructs/lambda\";\nimport type { GuFunctionProps } from \"../constructs/lambda\";\nimport type { ApiGatewayAlarms } from \"./api-multiple-lambdas\";\n\ninterface ApiProps extends Omit<LambdaRestApiProps, \"handler\"> {\n id: string;\n}\n\nexport interface GuApiLambdaProps extends Omit<GuFunctionProps, \"errorPercentageMonitoring\"> {\n /**\n * [[`LambdaRestApiProps`]] to configure for the lambda.\n */\n api: ApiProps;\n /**\n * Alarm configuration for your API. For more details, see [[`ApiGatewayAlarms`]].\n *\n * If your team do not use CloudWatch, it's possible to opt-out with the following configuration:\n * ```typescript\n * monitoringConfiguration: { noMonitoring: true }\n * ```\n */\n monitoringConfiguration: NoMonitoring | ApiGatewayAlarms;\n}\n\n/**\n * A pattern to create a Lambda triggered by API Gateway\n * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-with-lambda-integration.html\n *\n * This pattern should be used if you intend to serve all traffic via a single Lambda\n * (for example, if your Lambda uses an application framework, like https://github.com/vendia/serverless-express).\n * If you need to configure path-based routing to serve different requests with different\n * Lambdas, use the [[`GuApiGatewayWithLambdaByPath`]] pattern instead.\n *\n * For all configuration options, see [[`GuApiLambdaProps`]].\n *\n * Example usage:\n *\n * ```typescript\n * new GuApiLambda(stack, \"my-lambda\", {\n * fileName: \"my-app.zip\",\n * handler: \"handler.ts\",\n * runtime: Runtime.NODEJS_14_X,\n * monitoringConfiguration: {\n * http5xxAlarm: { tolerated5xxPercentage: 5 },\n * snsTopicName: \"alerts-topic\",\n * },\n * app: \"my-app\",\n * api: {\n * id: \"my-api\",\n * description: \"...\",\n * },\n * });\n * ```\n */\nexport class GuApiLambda extends GuLambdaFunction {\n public readonly api: LambdaRestApi;\n\n constructor(scope: GuStack, id: string, props: GuApiLambdaProps) {\n super(scope, id, {\n ...props,\n });\n\n this.api = new LambdaRestApi(this, props.api.id, {\n handler: this,\n\n // Override to avoid clashes as default is just api ID, which is often shared across stages.\n restApiName: `${scope.stack}-${scope.stage}-${props.api.id}`,\n\n ...props.api,\n });\n\n if (!props.monitoringConfiguration.noMonitoring) {\n new GuApiGateway5xxPercentageAlarm(scope, {\n app: props.app,\n apiGatewayInstance: this.api,\n snsTopicName: props.monitoringConfiguration.snsTopicName,\n ...props.monitoringConfiguration.http5xxAlarm,\n });\n }\n }\n}\n"]}
|
|
@@ -4,7 +4,13 @@ import { Construct } from "constructs";
|
|
|
4
4
|
import type { Http5xxAlarmProps, NoMonitoring } from "../constructs/cloudwatch";
|
|
5
5
|
import type { AppIdentity, GuStack } from "../constructs/core";
|
|
6
6
|
import type { GuLambdaFunction } from "../constructs/lambda";
|
|
7
|
+
/**
|
|
8
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
|
|
9
|
+
*/
|
|
7
10
|
export type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
|
|
11
|
+
/**
|
|
12
|
+
* API target props.
|
|
13
|
+
*/
|
|
8
14
|
export interface ApiTarget {
|
|
9
15
|
/**
|
|
10
16
|
* The path for the request (e.g. /test).
|
|
@@ -24,22 +30,20 @@ export interface ApiTarget {
|
|
|
24
30
|
apiKeyRequired?: true;
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* For example:
|
|
30
|
-
*
|
|
31
|
-
* ```typescript
|
|
32
|
-
* monitoringConfiguration: {
|
|
33
|
-
* snsTopicName: "my-topic-for-cloudwatch-alerts",
|
|
34
|
-
* http5xxAlarm: {
|
|
35
|
-
* tolerated5xxPercentage: <sensible_error_percentage_threshold>,
|
|
36
|
-
* }
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
33
|
+
* Alarm props.
|
|
39
34
|
*/
|
|
40
35
|
export interface ApiGatewayAlarms {
|
|
36
|
+
/**
|
|
37
|
+
* (SNS) Topic name where alarm notifications will be sent.
|
|
38
|
+
*/
|
|
41
39
|
snsTopicName: string;
|
|
40
|
+
/**
|
|
41
|
+
* Configuration the 5xx alarm.
|
|
42
|
+
*/
|
|
42
43
|
http5xxAlarm: Http5xxAlarmProps;
|
|
44
|
+
/**
|
|
45
|
+
* Internal flag - users of this library should ignore this setting.
|
|
46
|
+
*/
|
|
43
47
|
noMonitoring?: false;
|
|
44
48
|
}
|
|
45
49
|
export interface GuApiGatewayWithLambdaByPathProps extends RestApiProps, AppIdentity {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-multiple-lambdas.d.ts","sourceRoot":"","sources":["../../src/patterns/api-multiple-lambdas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,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M,CAAC;IACrB;;OAEG;IACH,YAAY,EAAE,iBAAiB,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,iCAAkC,SAAQ,YAAY,EAAE,WAAW;IAClF;;OAEG;IACH,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB;;;;;;;OAOG;IACH,uBAAuB,EAAE,YAAY,GAAG,gBAAgB,CAAC;CAC1D;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,4BAA6B,SAAQ,SAAS;IACzD,SAAgB,GAAG,EAAE,OAAO,CAAC;gBAEjB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC;CAwBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-multiple-lambdas.js","sourceRoot":"","sources":["../../src/patterns/api-multiple-lambdas.ts"],"names":[],"mappings":";;;AACA,+DAAwE;AACxE,2CAAuC;AAEvC,oFAA6F;
|
|
1
|
+
{"version":3,"file":"api-multiple-lambdas.js","sourceRoot":"","sources":["../../src/patterns/api-multiple-lambdas.ts"],"names":[],"mappings":";;;AACA,+DAAwE;AACxE,2CAAuC;AAEvC,oFAA6F;AAiE7F,SAAS,cAAc,CACrB,uBAAwD;IAExD,OAAsB,uBAAwB,CAAC,YAAY,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAa,4BAA6B,SAAQ,sBAAS;IAGzD,YAAY,KAAc,EAAE,KAAwC;QAClE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,oCAAoC;QAC7D,MAAM,UAAU,GAAG,IAAI,wBAAO,CAAC,KAAK,EAAE,SAAS,EAAE;YAC/C,4FAA4F;YAC5F,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,EAAE;YACzD,GAAG,KAAK;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC;QACtB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC9D,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,kCAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBAC1E,cAAc,EAAE,MAAM,CAAC,cAAc;aACtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE;YAClD,IAAI,mDAA8B,CAAC,KAAK,EAAE;gBACxC,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,kBAAkB,EAAE,UAAU;gBAC9B,YAAY,EAAE,KAAK,CAAC,uBAAuB,CAAC,YAAY;gBACxD,GAAG,KAAK,CAAC,uBAAuB,CAAC,YAAY;aAC9C,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA3BD,oEA2BC","sourcesContent":["import type { RestApiProps } from \"aws-cdk-lib/aws-apigateway\";\nimport { LambdaIntegration, RestApi } from \"aws-cdk-lib/aws-apigateway\";\nimport { Construct } from \"constructs\";\nimport type { Http5xxAlarmProps, NoMonitoring } from \"../constructs/cloudwatch\";\nimport { GuApiGateway5xxPercentageAlarm } from \"../constructs/cloudwatch/api-gateway-alarms\";\nimport type { AppIdentity, GuStack } from \"../constructs/core\";\nimport type { GuLambdaFunction } from \"../constructs/lambda\";\n\n/**\n * See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods\n */\nexport type HttpMethod = \"GET\" | \"HEAD\" | \"POST\" | \"PUT\" | \"DELETE\" | \"CONNECT\" | \"OPTIONS\" | \"TRACE\" | \"PATCH\";\n\n/**\n * API target props.\n */\nexport interface ApiTarget {\n /**\n * The path for the request (e.g. /test).\n */\n path: string;\n /**\n * The [[`HttpMethod`]] for the target (e.g. GET, POST, PUT).\n */\n httpMethod: HttpMethod;\n /**\n * The Lambda function responsible for handling the request.\n */\n lambda: GuLambdaFunction;\n /**\n * Whether an apiKey is required for this method.\n */\n apiKeyRequired?: true;\n}\n\n/**\n * Alarm props.\n */\nexport interface ApiGatewayAlarms {\n /**\n * (SNS) Topic name where alarm notifications will be sent.\n */\n snsTopicName: string;\n /**\n * Configuration the 5xx alarm.\n */\n http5xxAlarm: Http5xxAlarmProps;\n /**\n * Internal flag - users of this library should ignore this setting.\n */\n noMonitoring?: false;\n}\n\nexport interface GuApiGatewayWithLambdaByPathProps extends RestApiProps, AppIdentity {\n /**\n * A list of [[`ApiTarget`]]s to configure for the API Gateway instance.\n */\n targets: ApiTarget[];\n /**\n * Alarm configuration for your API. For more details, see [[`ApiGatewayAlarms`]].\n *\n * If your team do not use CloudWatch, it's possible to opt-out with the following configuration:\n * ```typescript\n * monitoringConfiguration: { noMonitoring: true }\n * ```\n */\n monitoringConfiguration: NoMonitoring | ApiGatewayAlarms;\n}\n\nfunction isNoMonitoring(\n monitoringConfiguration: NoMonitoring | ApiGatewayAlarms\n): monitoringConfiguration is NoMonitoring {\n return (<NoMonitoring>monitoringConfiguration).noMonitoring;\n}\n\n/**\n * A pattern to create an API Gateway instance which uses path-based routing to route requests\n * to two or more Lambda functions.\n *\n * This pattern should be used if you need to configure path-based routing to serve different\n * requests with different Lambdas. If you intend to serve all traffic via a single Lambda, use\n * the [[`GuApiLambda`]] pattern instead.\n *\n * Example usage:\n *\n * ```typescript\n * // Configure lambdas\n * const lambdaOne = new GuLambdaFunction(this, \"lambda-one\", {\n * app: \"example-lambda-one\",\n * runtime: Runtime.NODEJS_14_X,\n * handler: \"lambda-one.handler\",\n * fileName: \"lambda-one.zip\",\n * });\n * const lambdaTwo = new GuLambdaFunction(this, \"lambda-two\", {\n * app: \"example-lambda-two\",\n * runtime: Runtime.NODEJS_14_X,\n * handler: \"lambda-two.handler\",\n * fileName: \"lambda-two.zip\",\n * });\n *\n * // Wire up the API\n * new GuApiGatewayWithLambdaByPath(this, {\n * app: \"example-api-gateway-instance\",\n * targets: [\n * {\n * path: \"lambda-one\",\n * httpMethod: \"GET\",\n * lambda: lambdaOne,\n * },\n * {\n * path: \"lambda-two\",\n * httpMethod: \"GET\",\n * lambda: lambdaTwo,\n * },\n * ],\n * // Create an alarm\n * monitoringConfiguration: {\n * snsTopicName: \"my-topic-for-cloudwatch-alerts\",\n * http5xxAlarm: {\n * tolerated5xxPercentage: 1,\n * }\n * }\n * });\n * ```\n *\n * For all API configuration options, see [[`GuApiGatewayWithLambdaByPathProps`]].\n *\n * For details on configuring the individual Lambda functions, see [[`GuLambdaFunction`]].\n */\nexport class GuApiGatewayWithLambdaByPath extends Construct {\n public readonly api: RestApi;\n\n constructor(scope: GuStack, props: GuApiGatewayWithLambdaByPathProps) {\n super(scope, props.app); // The assumption is `app` is unique\n const apiGateway = new RestApi(scope, \"RestApi\", {\n // Override to avoid clashes as default is just api ID, which is often shared across stages.\n restApiName: `${scope.stack}-${scope.stage}-${props.app}`,\n ...props,\n });\n\n this.api = apiGateway;\n props.targets.map((target) => {\n const resource = apiGateway.root.resourceForPath(target.path);\n resource.addMethod(target.httpMethod, new LambdaIntegration(target.lambda), {\n apiKeyRequired: target.apiKeyRequired,\n });\n });\n if (!isNoMonitoring(props.monitoringConfiguration)) {\n new GuApiGateway5xxPercentageAlarm(scope, {\n app: props.app,\n apiGatewayInstance: apiGateway,\n snsTopicName: props.monitoringConfiguration.snsTopicName,\n ...props.monitoringConfiguration.http5xxAlarm,\n });\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/patterns/ec2-app/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base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yB,CAAC;IACxD,SAAgB,gBAAgB,EAAE,kBAAkB,CAAC;IACrD,SAAgB,QAAQ,EAAE,0BAA0B,CAAC;IACrD,SAAgB,WAAW,EAAE,wBAAwB,CAAC;gBAE1C,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa;CAyKjD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuEc2App = void 0;
|
|
4
|
-
/* eslint "@guardian/tsdoc-required/tsdoc-required": 2 -- to begin rolling this out for public APIs. */
|
|
5
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
5
|
const aws_autoscaling_1 = require("aws-cdk-lib/aws-autoscaling");
|
|
7
6
|
const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/patterns/ec2-app/base.ts"],"names":[],"mappings":";;;AAAA,uGAAuG;AACvG,6CAA6C;AAE7C,iEAA0D;AAE1D,iDAA2C;AAC3C,uFAA6E;AAC7E,+CAA4C;AAC5C,2CAAuC;AACvC,+CAAuF;AACvF,8CAAqD;AAErD,8DAA8E;AAE9E,4DAAiG;AAEjG,gDAAqG;AACrG,8CAA0E;AAE1E,8CAAgF;AAChF,kEAIwC;AACxC,uCAAwC;AAkKxC,SAAS,oBAAoB,CAAC,MAAe;IAC3C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5B,KAAK;QACL,IAAI,EAAE,cAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACnB,WAAW,EAAE,iCAAiC,KAAK,CAAC,QAAQ,EAAE;KAC/D,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAa,QAAS,SAAQ,sBAAS;IAgBrC,YAAY,KAAc,EAAE,KAAoB;QAC9C,MAAM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,gBAAgB,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAzLD,4BAyLC","sourcesContent":["/* eslint \"@guardian/tsdoc-required/tsdoc-required\": 2 -- to begin rolling this out for public APIs. */\nimport { Duration, Tags } from \"aws-cdk-lib\";\nimport type { BlockDevice } from \"aws-cdk-lib/aws-autoscaling\";\nimport { HealthCheck } from \"aws-cdk-lib/aws-autoscaling\";\nimport type { InstanceType, IPeer, ISubnet, IVpc } from \"aws-cdk-lib/aws-ec2\";\nimport { Port } from \"aws-cdk-lib/aws-ec2\";\nimport { ApplicationProtocol } from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { Construct } from \"constructs\";\nimport { AccessScope, MetadataKeys, NAMED_SSM_PARAMETER_PATHS } from \"../../constants\";\nimport { GuCertificate } from \"../../constructs/acm\";\nimport type { GuUserDataProps } from \"../../constructs/autoscaling\";\nimport { GuAutoScalingGroup, GuUserData } from \"../../constructs/autoscaling\";\nimport type { Http5xxAlarmProps, NoMonitoring } from \"../../constructs/cloudwatch\";\nimport { GuAlb5xxPercentageAlarm, GuUnhealthyInstancesAlarm } from \"../../constructs/cloudwatch\";\nimport type { GuStack } from \"../../constructs/core\";\nimport { AppIdentity, GuLoggingStreamNameParameter, GuStringParameter } from \"../../constructs/core\";\nimport { GuSecurityGroup, GuVpc, SubnetType } from \"../../constructs/ec2\";\nimport type { GuInstanceRoleProps } from \"../../constructs/iam\";\nimport { GuGetPrivateConfigPolicy, GuInstanceRole } from \"../../constructs/iam\";\nimport {\n GuApplicationLoadBalancer,\n GuApplicationTargetGroup,\n GuHttpsApplicationListener,\n} from \"../../constructs/loadbalancing\";\nimport { AppAccess } from \"../../types\";\nimport type { GuAsgCapacity, GuDomainName } from \"../../types\";\nimport type { AmigoProps } from \"../../types/amigo\";\n\nexport interface AccessLoggingProps {\n /**\n * Enable (load balancer) access logs.\n *\n * Note, you will need to specify a region in your stack declaration to use\n * this.\n * See`https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationLoadBalancer.html#logwbraccesswbrlogsbucket-prefix`\n */\n enabled: boolean;\n /**\n * S3 prefix for the logs.\n *\n * @defaultValue no prefix\n */\n prefix?: string;\n}\n\n/**\n * To ship your application logs to ELK automatically, you must:\n *\n * 1. Set the `enabled` flag to true\n * 2. Include the `cdk-base` Amigo role in your AMI\n * 3. Log to `journald`. We recommend doing this by logging to `stdout` and\n * using `systemd` to start your app\n * 4. Confirm that your [[`systemdUnitName`]] is configured properly.\n *\n * Unless you have explicitly opted-out, appropriate IAM permissions for logging\n * to Kinesis will be configured automatically via the [[`GuEc2App`]] pattern.\n */\nexport interface ApplicationLoggingProps {\n /**\n * Enables forwarding of application logs to the Guardian ELK stack.\n *\n * Note, to work, you will need to also do the following non-CDK things:\n *\n * 1. Include the `cdk-base` Amigo role in your AMI.\n * 2. Log to `journald`. We recommend doing this by logging to `stdout` and\n * using `systemd` to start your app\n * 3. Confirm that your [[`systemdUnitName`]] is configured properly.\n *\n * Unless you have explicitly opted-out, appropriate IAM permissions for\n * logging to Kinesis will be configured automatically via the [[`GuEc2App`]]\n * pattern.\n *\n * @see https://github.com/guardian/amigo/tree/main/roles/cdk-base\n */\n enabled: boolean;\n /**\n * This needs to match the name of your SystemD unit.\n *\n * If your systemd unit is not `<app>.service` set this value.\n *\n * @defaultValue `<app>.service`\n */\n systemdUnitName?: string;\n}\n\n/**\n * @privateRemarks we should rename this to AlarmsProps.\n */\nexport interface Alarms {\n /**\n * Name of the target (SNS Topic) for alarm notifications.\n */\n snsTopicName: string;\n /**\n * Enable the 5xx alarm with settings.\n */\n http5xxAlarm: false | Http5xxAlarmProps;\n /**\n * Enable the unhealthy instances alarm.\n */\n unhealthyInstancesAlarm: boolean;\n /**\n * Internal flag - users of this library should ignore this setting.\n */\n noMonitoring?: false;\n}\n\nexport interface GuEc2AppProps extends AppIdentity {\n /**\n * User data for the autoscaling group.\n */\n userData: GuUserDataProps | string;\n /**\n * Network access restrictions for your load balancer.\n *\n * Note, this merely provides defence in depth; you should, for example, limit\n * access to the VPN and then treat that as sufficient. Instead, use Google\n * Auth for human access, or a suitable machine auth mechanism.\n */\n access: AppAccess;\n /**\n * The port your application runs on.\n */\n applicationPort: number;\n /**\n * Configure IAM roles for autoscaling group EC2 instances.\n */\n roleConfiguration?: GuInstanceRoleProps;\n /**\n * Enable and configure alarms.\n */\n monitoringConfiguration: Alarms | NoMonitoring;\n /**\n * EC2 instance type. Note, ensure your code is built for the same\n * architecture family (arm64 - 'Graviton' instances - or x64).\n */\n instanceType: InstanceType;\n /**\n * Enable and configures application logs.\n */\n applicationLogging?: ApplicationLoggingProps;\n /**\n * Enable and configures access logs.\n */\n accessLogging?: AccessLoggingProps;\n /**\n * Add block devices (additional storage).\n */\n blockDevices?: BlockDevice[];\n /**\n * Autoscaling group min and max sizes.\n */\n scaling: GuAsgCapacity;\n /**\n * Specify certificate for the load balancer.\n */\n certificateProps?: GuDomainName;\n /**\n * Disable imdsv2. Most of the time you should not set this.\n *\n * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html\n */\n withoutImdsv2?: boolean;\n /**\n * Configure Amigo image recipe.\n */\n imageRecipe?: string | AmigoProps;\n /**\n * Specify the VPC to use.\n *\n * @see https://github.com/guardian/aws-account-setup\n */\n vpc?: IVpc;\n /**\n * Specify private subnets if using a non-default VPC or (generally\n * discouraged) to limit to a subset of the available subnets.\n */\n privateSubnets?: ISubnet[];\n\n /**\n * Specify private subnets if using a non-default VPC or (generally\n * discouraged) to limit to a subset of the available subnets.\n */\n publicSubnets?: ISubnet[];\n}\n\nfunction restrictedCidrRanges(ranges: IPeer[]) {\n return ranges.map((range) => ({\n range,\n port: Port.tcp(443),\n description: `Allow access on port 443 from ${range.uniqueId}`,\n }));\n}\n\n/**\n * Pattern which creates the resources needed to run an application on EC2\n * behind a load balancer. For convenience, you may wish to use [[`GuPlayApp`]]\n * or [[`GuNodeApp`]], which extend this class.\n *\n * See props for further details.\n */\nexport class GuEc2App extends Construct {\n /*\n * These are public for now, as this allows users to\n * modify these constructs as desired to fit their\n * specific needs.\n * In the future, we might build functionality to better enable users\n * to access in-pattern constructs, but this would allow teams to be unblocked\n * in the short term.\n * */\n public readonly vpc: IVpc;\n public readonly certificate?: GuCertificate;\n public readonly loadBalancer: GuApplicationLoadBalancer;\n public readonly autoScalingGroup: GuAutoScalingGroup;\n public readonly listener: GuHttpsApplicationListener;\n public readonly targetGroup: GuApplicationTargetGroup;\n\n constructor(scope: GuStack, props: GuEc2AppProps) {\n const {\n access,\n accessLogging = { enabled: false },\n app,\n // We should update this default once a significant number of apps have migrated to devx-logs\n applicationLogging = { enabled: false },\n applicationPort,\n blockDevices,\n certificateProps,\n instanceType,\n monitoringConfiguration,\n roleConfiguration = { withoutLogShipping: false, additionalPolicies: [] },\n scaling: { minimumInstances, maximumInstances = minimumInstances * 2 },\n userData,\n withoutImdsv2,\n imageRecipe,\n vpc = GuVpc.fromIdParameter(scope, AppIdentity.suffixText({ app }, \"VPC\")),\n privateSubnets = GuVpc.subnetsFromParameter(scope, { type: SubnetType.PRIVATE, app }),\n publicSubnets = GuVpc.subnetsFromParameter(scope, { type: SubnetType.PUBLIC, app }),\n } = props;\n\n super(scope, app); // The assumption is `app` is unique\n\n // We should really prevent users from doing this via the type system,\n // but that requires a breaking change to the API\n if (applicationLogging.enabled && roleConfiguration.withoutLogShipping) {\n throw new Error(\n \"Application logging has been enabled (via the `applicationLogging` prop) but your `roleConfiguration` sets \" +\n \"`withoutLogShipping` to true. Please turn off application logging or remove `withoutLogShipping`\"\n );\n }\n\n AppAccess.validate(access);\n\n const certificate =\n typeof certificateProps !== \"undefined\"\n ? new GuCertificate(scope, {\n app,\n domainName: certificateProps.domainName,\n hostedZoneId: certificateProps.hostedZoneId,\n })\n : undefined;\n\n const maybePrivateConfigPolicy =\n typeof userData !== \"string\" && userData.configuration\n ? [new GuGetPrivateConfigPolicy(scope, \"GetPrivateConfigFromS3Policy\", userData.configuration)]\n : [];\n\n const mergedRoleConfiguration: GuInstanceRoleProps = {\n withoutLogShipping: roleConfiguration.withoutLogShipping,\n additionalPolicies: maybePrivateConfigPolicy.concat(roleConfiguration.additionalPolicies ?? []),\n };\n\n const autoScalingGroup = new GuAutoScalingGroup(scope, \"AutoScalingGroup\", {\n app,\n vpc,\n instanceType,\n minimumInstances,\n maximumInstances,\n withoutImdsv2,\n role: new GuInstanceRole(scope, { app, ...mergedRoleConfiguration }),\n healthCheck: HealthCheck.elb({ grace: Duration.minutes(2) }), // should this be defaulted at pattern or construct level?\n userData: typeof userData !== \"string\" ? new GuUserData(scope, { app, ...userData }).userData : userData,\n vpcSubnets: { subnets: privateSubnets },\n ...(blockDevices && { blockDevices }),\n imageRecipe,\n });\n\n // This allows automatic shipping of instance Cloud Init logs when using the\n // `cdk-base` Amigo role on your AMI.\n Tags.of(autoScalingGroup).add(\n MetadataKeys.LOG_KINESIS_STREAM_NAME,\n GuLoggingStreamNameParameter.getInstance(scope).valueAsString\n );\n\n if (applicationLogging.enabled) {\n // This allows automatic shipping of application logs when using the\n // `cdk-base` Amigo role on your AMI.\n Tags.of(autoScalingGroup).add(\n MetadataKeys.SYSTEMD_UNIT,\n applicationLogging.systemdUnitName ? `${applicationLogging.systemdUnitName}.service` : `${app}.service`\n );\n }\n\n const loadBalancer = new GuApplicationLoadBalancer(scope, \"LoadBalancer\", {\n app,\n vpc,\n // Setting internetFacing to true does not necessarily allow public access to the load balancer itself. That is handled by the listener's `open` prop.\n internetFacing: access.scope !== AccessScope.INTERNAL,\n vpcSubnets: {\n subnets: access.scope === AccessScope.INTERNAL ? privateSubnets : publicSubnets,\n },\n });\n\n if (accessLogging.enabled) {\n const accessLoggingBucket = new GuStringParameter(scope, \"AccessLoggingBucket\", {\n description: NAMED_SSM_PARAMETER_PATHS.AccessLoggingBucket.description,\n default: NAMED_SSM_PARAMETER_PATHS.AccessLoggingBucket.path,\n fromSSM: true,\n });\n\n loadBalancer.logAccessLogs(\n Bucket.fromBucketName(\n scope,\n AppIdentity.suffixText(props, \"AccessLoggingBucket\"),\n accessLoggingBucket.valueAsString\n ),\n accessLogging.prefix\n );\n }\n\n const targetGroup = new GuApplicationTargetGroup(scope, \"TargetGroup\", {\n app,\n vpc,\n protocol: ApplicationProtocol.HTTP,\n targets: [autoScalingGroup],\n port: applicationPort,\n });\n\n const listener = new GuHttpsApplicationListener(scope, \"Listener\", {\n app,\n loadBalancer,\n certificate,\n targetGroup,\n // When open=true, AWS will create a security group which allows all inbound traffic over HTTPS\n open: access.scope === AccessScope.PUBLIC && typeof certificate !== \"undefined\",\n });\n\n // Since AWS won't create a security group automatically when open=false, we need to add our own\n if (access.scope !== AccessScope.PUBLIC) {\n loadBalancer.addSecurityGroup(\n new GuSecurityGroup(scope, `${access.scope}IngressSecurityGroup`, {\n app,\n vpc,\n description: \"Allow restricted ingress from CIDR ranges\",\n allowAllOutbound: false,\n ingresses: restrictedCidrRanges(access.cidrRanges),\n })\n );\n }\n\n if (!monitoringConfiguration.noMonitoring) {\n const { http5xxAlarm, snsTopicName, unhealthyInstancesAlarm } = monitoringConfiguration;\n\n if (http5xxAlarm) {\n new GuAlb5xxPercentageAlarm(scope, {\n app,\n loadBalancer,\n snsTopicName,\n ...http5xxAlarm,\n });\n }\n if (unhealthyInstancesAlarm) {\n new GuUnhealthyInstancesAlarm(scope, {\n app,\n targetGroup,\n snsTopicName,\n });\n }\n }\n\n this.vpc = vpc;\n this.certificate = certificate;\n this.loadBalancer = loadBalancer;\n this.autoScalingGroup = autoScalingGroup;\n this.listener = listener;\n this.targetGroup = targetGroup;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/patterns/ec2-app/base.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAE7C,iEAA0D;AAE1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I,CAAC,uBAAuB,CAAC,YAAY,EAAE;YACzC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,GAAG,uBAAuB,CAAC;YAExF,IAAI,YAAY,EAAE;gBAChB,IAAI,oCAAuB,CAAC,KAAK,EAAE;oBACjC,GAAG;oBACH,YAAY;oBACZ,YAAY;oBACZ,GAAG,YAAY;iBAChB,CAAC,CAAC;aACJ;YACD,IAAI,uBAAuB,EAAE;gBAC3B,IAAI,sCAAyB,CAAC,KAAK,EAAE;oBACnC,GAAG;oBACH,WAAW;oBACX,YAAY;iBACb,CAAC,CAAC;aACJ;SACF;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAzLD,4BAyLC","sourcesContent":["import { Duration, Tags } from \"aws-cdk-lib\";\nimport type { BlockDevice } from \"aws-cdk-lib/aws-autoscaling\";\nimport { HealthCheck } from \"aws-cdk-lib/aws-autoscaling\";\nimport type { InstanceType, IPeer, ISubnet, IVpc } from \"aws-cdk-lib/aws-ec2\";\nimport { Port } from \"aws-cdk-lib/aws-ec2\";\nimport { ApplicationProtocol } from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { Construct } from \"constructs\";\nimport { AccessScope, MetadataKeys, NAMED_SSM_PARAMETER_PATHS } from \"../../constants\";\nimport { GuCertificate } from \"../../constructs/acm\";\nimport type { GuUserDataProps } from \"../../constructs/autoscaling\";\nimport { GuAutoScalingGroup, GuUserData } from \"../../constructs/autoscaling\";\nimport type { Http5xxAlarmProps, NoMonitoring } from \"../../constructs/cloudwatch\";\nimport { GuAlb5xxPercentageAlarm, GuUnhealthyInstancesAlarm } from \"../../constructs/cloudwatch\";\nimport type { GuStack } from \"../../constructs/core\";\nimport { AppIdentity, GuLoggingStreamNameParameter, GuStringParameter } from \"../../constructs/core\";\nimport { GuSecurityGroup, GuVpc, SubnetType } from \"../../constructs/ec2\";\nimport type { GuInstanceRoleProps } from \"../../constructs/iam\";\nimport { GuGetPrivateConfigPolicy, GuInstanceRole } from \"../../constructs/iam\";\nimport {\n GuApplicationLoadBalancer,\n GuApplicationTargetGroup,\n GuHttpsApplicationListener,\n} from \"../../constructs/loadbalancing\";\nimport { AppAccess } from \"../../types\";\nimport type { GuAsgCapacity, GuDomainName } from \"../../types\";\nimport type { AmigoProps } from \"../../types/amigo\";\n\nexport interface AccessLoggingProps {\n /**\n * Enable (load balancer) access logs.\n *\n * Note, you will need to specify a region in your stack declaration to use\n * this.\n * See`https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationLoadBalancer.html#logwbraccesswbrlogsbucket-prefix`\n */\n enabled: boolean;\n /**\n * S3 prefix for the logs.\n *\n * @defaultValue no prefix\n */\n prefix?: string;\n}\n\n/**\n * To ship your application logs to ELK automatically, you must:\n *\n * 1. Set the `enabled` flag to true\n * 2. Include the `cdk-base` Amigo role in your AMI\n * 3. Log to `journald`. We recommend doing this by logging to `stdout` and\n * using `systemd` to start your app\n * 4. Confirm that your [[`systemdUnitName`]] is configured properly.\n *\n * Unless you have explicitly opted-out, appropriate IAM permissions for logging\n * to Kinesis will be configured automatically via the [[`GuEc2App`]] pattern.\n */\nexport interface ApplicationLoggingProps {\n /**\n * Enables forwarding of application logs to the Guardian ELK stack.\n *\n * Note, to work, you will need to also do the following non-CDK things:\n *\n * 1. Include the `cdk-base` Amigo role in your AMI.\n * 2. Log to `journald`. We recommend doing this by logging to `stdout` and\n * using `systemd` to start your app\n * 3. Confirm that your [[`systemdUnitName`]] is configured properly.\n *\n * Unless you have explicitly opted-out, appropriate IAM permissions for\n * logging to Kinesis will be configured automatically via the [[`GuEc2App`]]\n * pattern.\n *\n * @see https://github.com/guardian/amigo/tree/main/roles/cdk-base\n */\n enabled: boolean;\n /**\n * This needs to match the name of your SystemD unit.\n *\n * If your systemd unit is not `<app>.service` set this value.\n *\n * @defaultValue `<app>.service`\n */\n systemdUnitName?: string;\n}\n\n/**\n * @privateRemarks we should rename this to AlarmsProps.\n */\nexport interface Alarms {\n /**\n * Name of the target (SNS Topic) for alarm notifications.\n */\n snsTopicName: string;\n /**\n * Enable the 5xx alarm with settings.\n */\n http5xxAlarm: false | Http5xxAlarmProps;\n /**\n * Enable the unhealthy instances alarm.\n */\n unhealthyInstancesAlarm: boolean;\n /**\n * Internal flag - users of this library should ignore this setting.\n */\n noMonitoring?: false;\n}\n\nexport interface GuEc2AppProps extends AppIdentity {\n /**\n * User data for the autoscaling group.\n */\n userData: GuUserDataProps | string;\n /**\n * Network access restrictions for your load balancer.\n *\n * Note, this merely provides defence in depth; you should, for example, limit\n * access to the VPN and then treat that as sufficient. Instead, use Google\n * Auth for human access, or a suitable machine auth mechanism.\n */\n access: AppAccess;\n /**\n * The port your application runs on.\n */\n applicationPort: number;\n /**\n * Configure IAM roles for autoscaling group EC2 instances.\n */\n roleConfiguration?: GuInstanceRoleProps;\n /**\n * Enable and configure alarms.\n */\n monitoringConfiguration: Alarms | NoMonitoring;\n /**\n * EC2 instance type. Note, ensure your code is built for the same\n * architecture family (arm64 - 'Graviton' instances - or x64).\n */\n instanceType: InstanceType;\n /**\n * Enable and configures application logs.\n */\n applicationLogging?: ApplicationLoggingProps;\n /**\n * Enable and configures access logs.\n */\n accessLogging?: AccessLoggingProps;\n /**\n * Add block devices (additional storage).\n */\n blockDevices?: BlockDevice[];\n /**\n * Autoscaling group min and max sizes.\n */\n scaling: GuAsgCapacity;\n /**\n * Specify certificate for the load balancer.\n */\n certificateProps?: GuDomainName;\n /**\n * Disable imdsv2. Most of the time you should not set this.\n *\n * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html\n */\n withoutImdsv2?: boolean;\n /**\n * Configure Amigo image recipe.\n */\n imageRecipe?: string | AmigoProps;\n /**\n * Specify the VPC to use.\n *\n * @see https://github.com/guardian/aws-account-setup\n */\n vpc?: IVpc;\n /**\n * Specify private subnets if using a non-default VPC or (generally\n * discouraged) to limit to a subset of the available subnets.\n */\n privateSubnets?: ISubnet[];\n\n /**\n * Specify private subnets if using a non-default VPC or (generally\n * discouraged) to limit to a subset of the available subnets.\n */\n publicSubnets?: ISubnet[];\n}\n\nfunction restrictedCidrRanges(ranges: IPeer[]) {\n return ranges.map((range) => ({\n range,\n port: Port.tcp(443),\n description: `Allow access on port 443 from ${range.uniqueId}`,\n }));\n}\n\n/**\n * Pattern which creates the resources needed to run an application on EC2\n * behind a load balancer. For convenience, you may wish to use [[`GuPlayApp`]]\n * or [[`GuNodeApp`]], which extend this class.\n *\n * See props for further details.\n */\nexport class GuEc2App extends Construct {\n /*\n * These are public for now, as this allows users to\n * modify these constructs as desired to fit their\n * specific needs.\n * In the future, we might build functionality to better enable users\n * to access in-pattern constructs, but this would allow teams to be unblocked\n * in the short term.\n * */\n public readonly vpc: IVpc;\n public readonly certificate?: GuCertificate;\n public readonly loadBalancer: GuApplicationLoadBalancer;\n public readonly autoScalingGroup: GuAutoScalingGroup;\n public readonly listener: GuHttpsApplicationListener;\n public readonly targetGroup: GuApplicationTargetGroup;\n\n constructor(scope: GuStack, props: GuEc2AppProps) {\n const {\n access,\n accessLogging = { enabled: false },\n app,\n // We should update this default once a significant number of apps have migrated to devx-logs\n applicationLogging = { enabled: false },\n applicationPort,\n blockDevices,\n certificateProps,\n instanceType,\n monitoringConfiguration,\n roleConfiguration = { withoutLogShipping: false, additionalPolicies: [] },\n scaling: { minimumInstances, maximumInstances = minimumInstances * 2 },\n userData,\n withoutImdsv2,\n imageRecipe,\n vpc = GuVpc.fromIdParameter(scope, AppIdentity.suffixText({ app }, \"VPC\")),\n privateSubnets = GuVpc.subnetsFromParameter(scope, { type: SubnetType.PRIVATE, app }),\n publicSubnets = GuVpc.subnetsFromParameter(scope, { type: SubnetType.PUBLIC, app }),\n } = props;\n\n super(scope, app); // The assumption is `app` is unique\n\n // We should really prevent users from doing this via the type system,\n // but that requires a breaking change to the API\n if (applicationLogging.enabled && roleConfiguration.withoutLogShipping) {\n throw new Error(\n \"Application logging has been enabled (via the `applicationLogging` prop) but your `roleConfiguration` sets \" +\n \"`withoutLogShipping` to true. Please turn off application logging or remove `withoutLogShipping`\"\n );\n }\n\n AppAccess.validate(access);\n\n const certificate =\n typeof certificateProps !== \"undefined\"\n ? new GuCertificate(scope, {\n app,\n domainName: certificateProps.domainName,\n hostedZoneId: certificateProps.hostedZoneId,\n })\n : undefined;\n\n const maybePrivateConfigPolicy =\n typeof userData !== \"string\" && userData.configuration\n ? [new GuGetPrivateConfigPolicy(scope, \"GetPrivateConfigFromS3Policy\", userData.configuration)]\n : [];\n\n const mergedRoleConfiguration: GuInstanceRoleProps = {\n withoutLogShipping: roleConfiguration.withoutLogShipping,\n additionalPolicies: maybePrivateConfigPolicy.concat(roleConfiguration.additionalPolicies ?? []),\n };\n\n const autoScalingGroup = new GuAutoScalingGroup(scope, \"AutoScalingGroup\", {\n app,\n vpc,\n instanceType,\n minimumInstances,\n maximumInstances,\n withoutImdsv2,\n role: new GuInstanceRole(scope, { app, ...mergedRoleConfiguration }),\n healthCheck: HealthCheck.elb({ grace: Duration.minutes(2) }), // should this be defaulted at pattern or construct level?\n userData: typeof userData !== \"string\" ? new GuUserData(scope, { app, ...userData }).userData : userData,\n vpcSubnets: { subnets: privateSubnets },\n ...(blockDevices && { blockDevices }),\n imageRecipe,\n });\n\n // This allows automatic shipping of instance Cloud Init logs when using the\n // `cdk-base` Amigo role on your AMI.\n Tags.of(autoScalingGroup).add(\n MetadataKeys.LOG_KINESIS_STREAM_NAME,\n GuLoggingStreamNameParameter.getInstance(scope).valueAsString\n );\n\n if (applicationLogging.enabled) {\n // This allows automatic shipping of application logs when using the\n // `cdk-base` Amigo role on your AMI.\n Tags.of(autoScalingGroup).add(\n MetadataKeys.SYSTEMD_UNIT,\n applicationLogging.systemdUnitName ? `${applicationLogging.systemdUnitName}.service` : `${app}.service`\n );\n }\n\n const loadBalancer = new GuApplicationLoadBalancer(scope, \"LoadBalancer\", {\n app,\n vpc,\n // Setting internetFacing to true does not necessarily allow public access to the load balancer itself. That is handled by the listener's `open` prop.\n internetFacing: access.scope !== AccessScope.INTERNAL,\n vpcSubnets: {\n subnets: access.scope === AccessScope.INTERNAL ? privateSubnets : publicSubnets,\n },\n });\n\n if (accessLogging.enabled) {\n const accessLoggingBucket = new GuStringParameter(scope, \"AccessLoggingBucket\", {\n description: NAMED_SSM_PARAMETER_PATHS.AccessLoggingBucket.description,\n default: NAMED_SSM_PARAMETER_PATHS.AccessLoggingBucket.path,\n fromSSM: true,\n });\n\n loadBalancer.logAccessLogs(\n Bucket.fromBucketName(\n scope,\n AppIdentity.suffixText(props, \"AccessLoggingBucket\"),\n accessLoggingBucket.valueAsString\n ),\n accessLogging.prefix\n );\n }\n\n const targetGroup = new GuApplicationTargetGroup(scope, \"TargetGroup\", {\n app,\n vpc,\n protocol: ApplicationProtocol.HTTP,\n targets: [autoScalingGroup],\n port: applicationPort,\n });\n\n const listener = new GuHttpsApplicationListener(scope, \"Listener\", {\n app,\n loadBalancer,\n certificate,\n targetGroup,\n // When open=true, AWS will create a security group which allows all inbound traffic over HTTPS\n open: access.scope === AccessScope.PUBLIC && typeof certificate !== \"undefined\",\n });\n\n // Since AWS won't create a security group automatically when open=false, we need to add our own\n if (access.scope !== AccessScope.PUBLIC) {\n loadBalancer.addSecurityGroup(\n new GuSecurityGroup(scope, `${access.scope}IngressSecurityGroup`, {\n app,\n vpc,\n description: \"Allow restricted ingress from CIDR ranges\",\n allowAllOutbound: false,\n ingresses: restrictedCidrRanges(access.cidrRanges),\n })\n );\n }\n\n if (!monitoringConfiguration.noMonitoring) {\n const { http5xxAlarm, snsTopicName, unhealthyInstancesAlarm } = monitoringConfiguration;\n\n if (http5xxAlarm) {\n new GuAlb5xxPercentageAlarm(scope, {\n app,\n loadBalancer,\n snsTopicName,\n ...http5xxAlarm,\n });\n }\n if (unhealthyInstancesAlarm) {\n new GuUnhealthyInstancesAlarm(scope, {\n app,\n targetGroup,\n snsTopicName,\n });\n }\n }\n\n this.vpc = vpc;\n this.certificate = certificate;\n this.loadBalancer = loadBalancer;\n this.autoScalingGroup = autoScalingGroup;\n this.listener = listener;\n this.targetGroup = targetGroup;\n }\n}\n"]}
|
|
@@ -2,34 +2,15 @@ import type { Schedule } from "aws-cdk-lib/aws-events";
|
|
|
2
2
|
import type { GuStack } from "../constructs/core";
|
|
3
3
|
import type { GuEcsTaskProps } from "../constructs/ecs";
|
|
4
4
|
import { GuEcsTask } from "../constructs/ecs";
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for the [[`GuScheduledEcsTask`]] pattern.
|
|
7
|
-
*
|
|
8
|
-
* The `schedule` property determines when your task is invoked. For example, to invoke
|
|
9
|
-
* the task every 5 minutes, use:
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { Schedule } from "aws-cdk-lib/aws-events";
|
|
12
|
-
* import { Duration } from "aws-cdk-lib/core";
|
|
13
|
-
*
|
|
14
|
-
* const props = {
|
|
15
|
-
* // Other props here
|
|
16
|
-
* schedule: Schedule.rate(Duration.minutes(5)),
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* To invoke the task every weekday at 8am, use:
|
|
21
|
-
* ```
|
|
22
|
-
* import { Schedule } from "aws-cdk-lib/aws-events";
|
|
23
|
-
*
|
|
24
|
-
* const props = {
|
|
25
|
-
* // Other props here
|
|
26
|
-
* schedule: Schedule.expression("cron(0 8 ? * MON-FRI *)"),
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
* See [[`GuEcsTask`]] for details of other props
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
5
|
export interface GuScheduledEcsTaskProps extends GuEcsTaskProps {
|
|
6
|
+
/**
|
|
7
|
+
* Schedule for the task.
|
|
8
|
+
*
|
|
9
|
+
* E.g.:
|
|
10
|
+
*
|
|
11
|
+
* - `Schedule.expression("cron(0 8 ? * MON-FRI *)")`
|
|
12
|
+
* - `Schedule.rate(Duration.minutes(5))`
|
|
13
|
+
*/
|
|
33
14
|
schedule: Schedule;
|
|
34
15
|
}
|
|
35
16
|
declare const GuScheduledEcsTask_base: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-ecs-task.d.ts","sourceRoot":"","sources":["../../src/patterns/scheduled-ecs-task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C
|
|
1
|
+
{"version":3,"file":"scheduled-ecs-task.d.ts","sourceRoot":"","sources":["../../src/patterns/scheduled-ecs-task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D;;;;;;;OAOG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB;;;;;;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,SAAQ,uBAA8B;gBACxD,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB;CASvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-ecs-task.js","sourceRoot":"","sources":["../../src/patterns/scheduled-ecs-task.ts"],"names":[],"mappings":";;;AACA,uDAA8C;AAC9C,uEAAiE;AAGjE,2CAA8C;AAC9C,4EAAyE;
|
|
1
|
+
{"version":3,"file":"scheduled-ecs-task.js","sourceRoot":"","sources":["../../src/patterns/scheduled-ecs-task.ts"],"names":[],"mappings":";;;AACA,uDAA8C;AAC9C,uEAAiE;AAGjE,2CAA8C;AAC9C,4EAAyE;AAczE;;;;;;;;;GASG;AACH,MAAa,kBAAmB,SAAQ,IAAA,yCAAmB,EAAC,eAAS,CAAC;IACpE,YAAY,KAAc,EAAE,EAAU,EAAE,KAA8B;QACpE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAExB,IAAI,iBAAI,CAAC,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE;YACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,CAAC,IAAI,oCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjD,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAVD,gDAUC","sourcesContent":["import type { Schedule } from \"aws-cdk-lib/aws-events\";\nimport { Rule } from \"aws-cdk-lib/aws-events\";\nimport { SfnStateMachine } from \"aws-cdk-lib/aws-events-targets\";\nimport type { GuStack } from \"../constructs/core\";\nimport type { GuEcsTaskProps } from \"../constructs/ecs\";\nimport { GuEcsTask } from \"../constructs/ecs\";\nimport { GuAppAwareConstruct } from \"../utils/mixin/app-aware-construct\";\n\nexport interface GuScheduledEcsTaskProps extends GuEcsTaskProps {\n /**\n * Schedule for the task.\n *\n * E.g.:\n *\n * - `Schedule.expression(\"cron(0 8 ? * MON-FRI *)\")`\n * - `Schedule.rate(Duration.minutes(5))`\n */\n schedule: Schedule;\n}\n\n/**\n * Pattern which creates all of the resources needed to invoke a fargate task on a schedule.\n *\n * The task will be wrapped in a step function to allow for easier triggering and alarming on failure.\n *\n * For all configuration options, see [[`GuScheduledEcsTaskProps`]].\n *\n * Note that if your task reliably completes in less than 15 minutes then you should probably use a [[`GuScheduledLambda`]] instead. This\n * pattern was mainly created to work around the 15 minute lambda timeout.\n */\nexport class GuScheduledEcsTask extends GuAppAwareConstruct(GuEcsTask) {\n constructor(scope: GuStack, id: string, props: GuScheduledEcsTaskProps) {\n super(scope, id, props);\n\n new Rule(scope, `${id}-ScheduleRule`, {\n schedule: props.schedule,\n targets: [new SfnStateMachine(this.stateMachine)],\n enabled: true,\n });\n }\n}\n"]}
|
|
@@ -3,55 +3,28 @@ import type { GuLambdaErrorPercentageMonitoringProps, NoMonitoring } from "../co
|
|
|
3
3
|
import type { GuStack } from "../constructs/core";
|
|
4
4
|
import { GuLambdaFunction } from "../constructs/lambda";
|
|
5
5
|
import type { GuFunctionProps } from "../constructs/lambda";
|
|
6
|
-
/**
|
|
7
|
-
* Configuration options for the [[`GuScheduledLambda`]] pattern.
|
|
8
|
-
*
|
|
9
|
-
* For all lambda function configuration options, see [[`GuFunctionProps`]].
|
|
10
|
-
*
|
|
11
|
-
* The `schedule` property determines when your lambda is invoked. For example, to invoke
|
|
12
|
-
* the lambda every 5 minutes, use:
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { Schedule } from "aws-cdk-lib/aws-events";
|
|
15
|
-
* import { Duration } from "aws-cdk-lib/core";
|
|
16
|
-
*
|
|
17
|
-
* const props = {
|
|
18
|
-
* // Other props here
|
|
19
|
-
* rules: [{ schedule: Schedule.rate(Duration.minutes(5)) }],
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* To invoke the lambda every weekday at 8am, use:
|
|
24
|
-
* ```
|
|
25
|
-
* import { Schedule } from "aws-cdk-lib/aws-events";
|
|
26
|
-
*
|
|
27
|
-
* const props = {
|
|
28
|
-
* // Other props here
|
|
29
|
-
* rules: [{ schedule: Schedule.expression("cron(0 8 ? * MON-FRI *)") }],
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* It is advisable to configure an alarm based on the lambda's error percentage.
|
|
34
|
-
* To do this, add the `monitoringConfiguration` property. The required properties for this are:
|
|
35
|
-
*
|
|
36
|
-
* ```typescript
|
|
37
|
-
* monitoringConfiguration: {
|
|
38
|
-
* toleratedErrorPercentage: <sensible_error_percentage_threshold>,
|
|
39
|
-
* snsTopicName: "my-topic-for-cloudwatch-alerts",
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
* Other alarm properties (e.g. alarm name and description) will be pre-populated with sensible defaults.
|
|
43
|
-
* For a full list of optional properties, see [[`GuLambdaErrorPercentageMonitoringProps`]].
|
|
44
|
-
*
|
|
45
|
-
* If your team do not use CloudWatch, it's possible to opt-out with the following configuration:
|
|
46
|
-
* ```typescript
|
|
47
|
-
* monitoringConfiguration: { noMonitoring: true }
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
6
|
export interface GuScheduledLambdaProps extends Omit<GuFunctionProps, "errorPercentageMonitoring"> {
|
|
7
|
+
/**
|
|
8
|
+
* Schedule(s) for the lambda task.
|
|
9
|
+
*/
|
|
51
10
|
rules: Array<{
|
|
11
|
+
/**
|
|
12
|
+
* E.g.:
|
|
13
|
+
*
|
|
14
|
+
* - `Schedule.expression("cron(0 8 ? * MON-FRI *)")`
|
|
15
|
+
* - `Schedule.rate(Duration.minutes(5))`
|
|
16
|
+
*/
|
|
52
17
|
schedule: Schedule;
|
|
18
|
+
/**
|
|
19
|
+
* Optional description.
|
|
20
|
+
*/
|
|
53
21
|
description?: string;
|
|
54
22
|
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Monitoring configuration for the lambda.
|
|
25
|
+
*
|
|
26
|
+
* Opting-out via the `NoMonitoring` type is supported but discouraged.
|
|
27
|
+
*/
|
|
55
28
|
monitoringConfiguration: NoMonitoring | GuLambdaErrorPercentageMonitoringProps;
|
|
56
29
|
}
|
|
57
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-lambda.d.ts","sourceRoot":"","sources":["../../src/patterns/scheduled-lambda.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,sCAAsC,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"scheduled-lambda.d.ts","sourceRoot":"","sources":["../../src/patterns/scheduled-lambda.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,sCAAsC,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,eAAe,EAAE,2BAA2B,CAAC;IAChG;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;QACX;;;;;WAKG;QACH,QAAQ,EAAE,QAAQ,CAAC;QACnB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH;;;;OAIG;IACH,uBAAuB,EAAE,YAAY,GAAG,sCAAsC,CAAC;CAChF;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAiBtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-lambda.js","sourceRoot":"","sources":["../../src/patterns/scheduled-lambda.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAE9C,uEAAgE;AAGhE,iDAAwD;
|
|
1
|
+
{"version":3,"file":"scheduled-lambda.js","sourceRoot":"","sources":["../../src/patterns/scheduled-lambda.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAE9C,uEAAgE;AAGhE,iDAAwD;AA4BxD;;;;GAIG;AACH,MAAa,iBAAkB,SAAQ,yBAAgB;IACrD,YAAY,KAAc,EAAE,EAAU,EAAE,KAA6B;QACnE,MAAM,WAAW,GAAoB;YACnC,GAAG,KAAK;YACR,yBAAyB,EAAE,KAAK,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB;SAClH,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;QAE9B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAClC,MAAM,MAAM,GAAG,IAAI,mCAAc,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,iBAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,KAAK,EAAE,EAAE;gBACjE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,OAAO,EAAE,CAAC,MAAM,CAAC;gBACjB,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC1D,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,8CAkBC","sourcesContent":["import { Rule } from \"aws-cdk-lib/aws-events\";\nimport type { Schedule } from \"aws-cdk-lib/aws-events\";\nimport { LambdaFunction } from \"aws-cdk-lib/aws-events-targets\";\nimport type { GuLambdaErrorPercentageMonitoringProps, NoMonitoring } from \"../constructs/cloudwatch\";\nimport type { GuStack } from \"../constructs/core\";\nimport { GuLambdaFunction } from \"../constructs/lambda\";\nimport type { GuFunctionProps } from \"../constructs/lambda\";\n\nexport interface GuScheduledLambdaProps extends Omit<GuFunctionProps, \"errorPercentageMonitoring\"> {\n /**\n * Schedule(s) for the lambda task.\n */\n rules: Array<{\n /**\n * E.g.:\n *\n * - `Schedule.expression(\"cron(0 8 ? * MON-FRI *)\")`\n * - `Schedule.rate(Duration.minutes(5))`\n */\n schedule: Schedule;\n /**\n * Optional description.\n */\n description?: string;\n }>;\n /**\n * Monitoring configuration for the lambda.\n *\n * Opting-out via the `NoMonitoring` type is supported but discouraged.\n */\n monitoringConfiguration: NoMonitoring | GuLambdaErrorPercentageMonitoringProps;\n}\n\n/**\n * Pattern which creates all of the resources needed to invoke a lambda function on a schedule.\n *\n * For all configuration options, see [[`GuScheduledLambdaProps`]].\n */\nexport class GuScheduledLambda extends GuLambdaFunction {\n constructor(scope: GuStack, id: string, props: GuScheduledLambdaProps) {\n const lambdaProps: GuFunctionProps = {\n ...props,\n errorPercentageMonitoring: props.monitoringConfiguration.noMonitoring ? undefined : props.monitoringConfiguration,\n };\n super(scope, id, lambdaProps);\n\n props.rules.forEach((rule, index) => {\n const target = new LambdaFunction(this);\n new Rule(this, `${id}-${rule.schedule.expressionString}-${index}`, {\n schedule: rule.schedule,\n targets: [target],\n ...(rule.description && { description: rule.description }),\n enabled: true,\n });\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guardian/cdk",
|
|
3
3
|
"description": "Generic Guardian flavoured AWS CDK components",
|
|
4
|
-
"version": "50.
|
|
4
|
+
"version": "50.3.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"prettier": "^2.8.7",
|
|
48
48
|
"semantic-release": "^19.0.5",
|
|
49
49
|
"serve": "^14.2.0",
|
|
50
|
-
"ts-jest": "^29.0
|
|
50
|
+
"ts-jest": "^29.1.0",
|
|
51
51
|
"ts-node": "^10.9.1",
|
|
52
52
|
"typedoc": "^0.23.28",
|
|
53
53
|
"typescript": "~4.9.5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@oclif/core": "2.
|
|
56
|
+
"@oclif/core": "2.8.0",
|
|
57
57
|
"aws-cdk-lib": "2.68.0",
|
|
58
|
-
"aws-sdk": "^2.
|
|
58
|
+
"aws-sdk": "^2.1351.0",
|
|
59
59
|
"chalk": "^4.1.2",
|
|
60
|
-
"codemaker": "^1.
|
|
60
|
+
"codemaker": "^1.80.0",
|
|
61
61
|
"constructs": "10.1.273",
|
|
62
62
|
"git-url-parse": "^13.1.0",
|
|
63
63
|
"js-yaml": "^4.1.0",
|