Dmitry Pavluk
03/26/2021, 4:11 AM# API GW: Set up throttling and metrics
aws apigatewayv2 update-stage \
--api-id xxx \
--stage-name '$default' \
--default-route-settings '{"ThrottlingBurstLimit":10,"ThrottlingRateLimit":50,"DetailedMetricsEnabled":true}'
# CFN: fix stupidity. See <https://github.com/serverless-stack/serverless-stack/issues/125>
aws logs put-resource-policy --policy-name AWSLogDeliveryWrite20150319 --policy-document "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"AWSLogDeliveryWrite\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"<http://delivery.logs.amazonaws.com|delivery.logs.amazonaws.com>\"},\"Action\":[\"logs:CreateLogStream\",\"logs:PutLogEvents\"],\"Resource\":[\"*\"]}]}"
# Aurora: enable Performance Insights on every instance. If needed: brew install jq
aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier]' \
| jq -r '.[]' | jq -r '.[]' \
| xargs -J % -L1 \
aws rds modify-db-instance \
--db-instance-identifier % \
--enable-performance-insights
Dmitry Pavluk
03/26/2021, 4:12 AMFrank
lambda.Function
to set the retain policy for the Lambda log group. That will allow setting the log groups to be deleted on stack removal.Frank
const api = new sst.Api(...);
api.httpApi.defaultStage.node.defaultChild.defaultRouteSettings = {
throttlingBurstLimit: 10,
throttlingRateLimit: 50,
detailedMetricsEnabled: true,
};
Frank
api.httpApi.defaultStage.node
give you the CloudFormation object for the default stage. This lets you edit the raw CF template.Dmitry Pavluk
03/26/2021, 10:07 AMDennis Dang
03/26/2021, 12:01 PMRoman Iaremchuk
07/15/2021, 9:14 AMFrank
api.httpApi.defaultStage.node.defaultChild as CfnStage
Frank
CfnStage
like this:
import { CfnStage } from "@aws-cdk/aws-apigatewayv2";
Roman Iaremchuk
07/15/2021, 11:48 AM