@certenza/aws-cdk-infrastructure-commons 1.1.0 → 1.1.1
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/dist/src/apigateway.js +8 -7
- package/package.json +1 -1
package/dist/src/apigateway.js
CHANGED
|
@@ -84,15 +84,16 @@ const createApiGateway = (scope, apiName, domainName, hostedZoneId, zoneName) =>
|
|
|
84
84
|
})),
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
|
|
87
|
+
// Set retention for execution log group that API Gateway creates automatically
|
|
88
|
+
// API Gateway creates execution logs in the format: API-Gateway-Execution-Logs_{api-id}/{stage-name}
|
|
89
|
+
// We use LogRetention to set the retention policy after API Gateway creates the log group
|
|
90
|
+
new logs.LogRetention(scope, `${apiName}-ExecutionLogRetention`, {
|
|
91
|
+
logGroupName: cdk.Token.asString(cdk.Fn.join("/", [
|
|
92
|
+
cdk.Fn.join("_", ["API-Gateway-Execution-Logs", api.restApiId]),
|
|
93
|
+
api.deploymentStage.stageName,
|
|
94
|
+
])),
|
|
91
95
|
retention: logs.RetentionDays.ONE_MONTH, // Budget-friendly: 1 month retention
|
|
92
|
-
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
93
96
|
});
|
|
94
|
-
// Ensure the log group is created after the API
|
|
95
|
-
executionLogGroup.node.addDependency(api);
|
|
96
97
|
// Create Route53 A record pointing to the API Gateway
|
|
97
98
|
new route53.ARecord(scope, `${apiName}-AliasRecord`, {
|
|
98
99
|
zone: hostedZone,
|
package/package.json
CHANGED