正在尝试创建云形成模板,以配置具有地理位置条件的WAF。找不到正确的模板。如有任何建议,我们将不胜感激。
http://docs.aws.amazon.com/waf/latest/developerguide/web-acl-geo-conditions.html
发布于 2018-07-24 13:43:18
不幸的是,实际的答案(截至2018年7月)是您不能直接在CloudFormation中创建地理匹配集。您可以通过CLI或SDK创建它们,然后在WAFRule的Predicates属性的DataId字段中引用它们。
通过命令行工具创建具有一个约束的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"
}
]
}
}发布于 2019-05-13 16:58:44
没有相应的文档,但可以在serverless/cloudformation中创建Geo Match。
在无服务器中使用了以下内容:
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"(cloudformation):
"MyRule": {
"Type": "AWS::WAFRegional::Rule",
"Properties": {
"Name": "waf",
"Predicates": [
{
"DataId": {
"Ref": "Geos"
},
"Negated": false,
"Type": "GeoMatch"
}
]
}
}发布于 2017-11-14 00:18:08
恐怕你的问题太含糊了,不能得到有帮助的答复。CloudFormation User Guide (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/,那么最新的云表单用户指南似乎还没有更新来反映这一点。
https://stackoverflow.com/questions/47215601
复制相似问题