尝试创建云形成模板以配置具有地理位置条件的 WAF。还没有找到合适的模板。任何指针将不胜感激。
http://docs.aws.amazon.com/waf/latest/developerguide/web-acl-geo-conditions.html
尝试创建云形成模板以配置具有地理位置条件的 WAF。还没有找到合适的模板。任何指针将不胜感激。
http://docs.aws.amazon.com/waf/latest/developerguide/web-acl-geo-conditions.html
不幸的是,实际答案(截至 2018 年 7 月撰写本文时)是您无法直接在 CloudFormation 中创建地理匹配集。您可以通过 CLI 或 SDK 创建它们,然后在DataId
WAFRule 的Predicates
属性字段中引用它们。
通过 CLI 创建具有一个约束的 GeoMatchSet:
aws waf-regional get-change-token
aws waf-regional create-geo-match-set --name my-geo-set --change-token <token>
aws waf-regional get-change-token
aws waf-regional update-geo-match-set --change-token <new_token> --geo-match-set-id <id> --updates '[ { "Action": "INSERT", "GeoMatchConstraint": { "Type": "Country", "Value": "US" } } ]'
现在在 CloudFormation 中引用 GeoMatchSet id:
"WebAclGeoRule": {
"Type": "AWS::WAFRegional::Rule",
"Properties": {
...
"Predicates": [
{
"DataId": "00000000-1111-2222-3333-123412341234" // id from create-geo-match-set
"Negated": false,
"Type": "GeoMatch"
}
]
}
}
没有相关文档,但可以在无服务器/云格式中创建地理匹配。
在无服务器中使用以下内容:
Resources:
Geos:
Type: "AWS::WAFRegional::GeoMatchSet"
Properties:
Name: geo
GeoMatchConstraints:
- Type: "Country"
Value: "IE"
在cloudformation中翻译为以下内容:
"Geos": {
"Type": "AWS::WAFRegional::GeoMatchSet",
"Properties": {
"Name": "geo",
"GeoMatchConstraints": [
{
"Type": "Country",
"Value": "IE"
}
]
}
}
然后可以在创建规则时引用它:
(无服务器):
Resources:
MyRule:
Type: "AWS::WAFRegional::Rule"
Properties:
Name: waf
Predicates:
- DataId:
Ref: "Geos"
Negated: false
Type: "GeoMatch"
(云形成):
"MyRule": {
"Type": "AWS::WAFRegional::Rule",
"Properties": {
"Name": "waf",
"Predicates": [
{
"DataId": {
"Ref": "Geos"
},
"Negated": false,
"Type": "GeoMatch"
}
]
}
}
恐怕您的问题太含糊,无法征求有用的答复。CloudFormation用户指南 (pdf)定义了许多不同的 WAF / CloudFront / R53 资源,这些资源将执行各种形式的地理匹配/地理阻止功能。您提供的链接似乎是 Web 访问控制列表 (Web ACL) 的子集 - 请参阅第 2540 页的 AWS::WAF::WebACL。
我建议您看一下,如果您仍然卡住,请实际描述您要实现的目标。
请注意,您使用的术语:“地理位置条件”与我知道的 AWS 功能没有直接关系。
最后,如果您指的是https://aws.amazon.com/about-aws/whats-new/2017/10/aws-waf-now-supports-geographic-match/,那么最新的 Cloudformation 用户指南不会似乎尚未更新以反映这一点。