[英]How to apply Security Policy on AWS API Gateway using AWS CloudFormation?
我有一個簡單的 cloudformation 模板,它正在為 API 網關創建自定義域,
該模板能夠創建自定義域。
但是我找不到將Custom Domain Security Policy
為TLS 1.2
的 cloudformation 屬性,
該模板使用默認的TLS 1.0 Security Policy
創建自定義域
模板 -
AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::Serverless-2016-10-31'
Description: Test Custom Domain
Resources:
test:
Type: AWS::ApiGateway::DomainName
Properties:
CertificateArn: !Sub 'arn:aws:acm:${AWS::Region}:${AWS::AccountId}:certificate/xxxx-xxx-xxx-xxxx-xxxx'
DomainName: 'test-api.example.com'
EndpointConfiguration:
Types:
- 'EDGE'
遺憾的是,此參數尚未通過 CloudFormation 公開。
這里有一張跟蹤其進展的票 - https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/3
目前,最好的辦法是創建自定義 CloudFormation 資源。
此參數通過 API 公開,並且可以由(至少部分)他們的 SDK 使用 - https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/apigateway.html#APIGateway.Client .create_domain_name
以下是討論如何創建客戶資源的文檔 - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html
2020 年 7 月添加了對在 API 網關域上指定安全策略的支持。 AWS Docs上提供了有關如何將此參數添加到 CloudFormation 模板的文檔。 安全策略的有效值為TLS_1_0
或TLS_1_2
。 下面的例子:
ApiCustomDomainName:
Type: 'AWS::ApiGateway::DomainName'
Condition: ApiGatewayEnabled
Properties:
DomainName: "example.com"
RegionalCertificateArn: !Ref CertificateArn
securityPolicy: "TLS_1_2"
EndpointConfiguration:
Types:
- REGIONAL
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.