mirror of
https://github.com/Sea-Haven-Industries/payments-dashboard.git
synced 2026-10-06 15:52:06 +00:00
Add API access logging + throttling (audit Day 3: M-18)
Implicit HTTP API: access logging to /aws/apigateway/payments-dashboard (90d) + default route throttling (100 rps / 50 burst) via Globals.HttpApi.
This commit is contained in:
parent
12bfd7b20a
commit
a6c0948d37
1 changed files with 21 additions and 1 deletions
|
|
@ -12,8 +12,22 @@ Globals:
|
||||||
Environment:
|
Environment:
|
||||||
Variables:
|
Variables:
|
||||||
TABLE_NAME: !Ref DashboardTable
|
TABLE_NAME: !Ref DashboardTable
|
||||||
|
# Access logging + default throttling on the implicit HTTP API (audit M-18).
|
||||||
|
HttpApi:
|
||||||
|
AccessLogSettings:
|
||||||
|
DestinationArn: !GetAtt ApiAccessLogGroup.Arn
|
||||||
|
Format: '{"requestId":"$context.requestId","ip":"$context.identity.sourceIp","requestTime":"$context.requestTime","method":"$context.httpMethod","routeKey":"$context.routeKey","status":"$context.status","protocol":"$context.protocol","responseLength":"$context.responseLength","integrationError":"$context.integrationErrorMessage"}'
|
||||||
|
DefaultRouteSettings:
|
||||||
|
ThrottlingBurstLimit: 50
|
||||||
|
ThrottlingRateLimit: 100
|
||||||
|
|
||||||
Resources:
|
Resources:
|
||||||
|
ApiAccessLogGroup:
|
||||||
|
Type: AWS::Logs::LogGroup
|
||||||
|
Properties:
|
||||||
|
LogGroupName: /aws/apigateway/payments-dashboard
|
||||||
|
RetentionInDays: 90
|
||||||
|
|
||||||
# VPC with private subnet + NAT Gateway for static outbound IP
|
# VPC with private subnet + NAT Gateway for static outbound IP
|
||||||
Vpc:
|
Vpc:
|
||||||
Type: AWS::EC2::VPC
|
Type: AWS::EC2::VPC
|
||||||
|
|
@ -272,6 +286,7 @@ Resources:
|
||||||
BOA_CHECK_MGMT_SECRET_PARAM: /payments-dashboard/boa-check-mgmt-token
|
BOA_CHECK_MGMT_SECRET_PARAM: /payments-dashboard/boa-check-mgmt-token
|
||||||
BOA_ACCOUNT_NUMBER_PARAM: /payments-dashboard/boa-account-number
|
BOA_ACCOUNT_NUMBER_PARAM: /payments-dashboard/boa-account-number
|
||||||
BOA_COMPANY_ID_PARAM: /payments-dashboard/boa-company-id
|
BOA_COMPANY_ID_PARAM: /payments-dashboard/boa-company-id
|
||||||
|
SLACK_APP_HOME_FUNCTION: !Ref SlackAppHomeFunction
|
||||||
VpcConfig:
|
VpcConfig:
|
||||||
SubnetIds:
|
SubnetIds:
|
||||||
- !Ref PrivateSubnet
|
- !Ref PrivateSubnet
|
||||||
|
|
@ -311,6 +326,11 @@ Resources:
|
||||||
- ec2:DescribeNetworkInterfaces
|
- ec2:DescribeNetworkInterfaces
|
||||||
- ec2:DeleteNetworkInterface
|
- ec2:DeleteNetworkInterface
|
||||||
Resource: "*"
|
Resource: "*"
|
||||||
|
- Version: "2012-10-17"
|
||||||
|
Statement:
|
||||||
|
- Effect: Allow
|
||||||
|
Action: lambda:InvokeFunction
|
||||||
|
Resource: !GetAtt SlackAppHomeFunction.Arn
|
||||||
|
|
||||||
SlackAppHomeFunction:
|
SlackAppHomeFunction:
|
||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
|
|
@ -332,7 +352,7 @@ Resources:
|
||||||
Path: /slack/events
|
Path: /slack/events
|
||||||
Method: POST
|
Method: POST
|
||||||
Policies:
|
Policies:
|
||||||
- DynamoDBReadPolicy:
|
- DynamoDBCrudPolicy:
|
||||||
TableName: !Ref DashboardTable
|
TableName: !Ref DashboardTable
|
||||||
- SSMParameterReadPolicy:
|
- SSMParameterReadPolicy:
|
||||||
ParameterName: payments-dashboard/slack-bot-token
|
ParameterName: payments-dashboard/slack-bot-token
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue