gpt4 book ai didi

json - CloudFormation - 如何使用 Sub 内在函数?

转载 作者:行者123 更新时间:2023-12-03 07:32:02 33 4
gpt4 key购买 nike

在下面的 JSON 规则中:

       {
"Action": [
"iam:CreatePolicyVersion",
"iam:DeletePolicy",
"iam:DeletePolicyVersion",
"iam:SetDefaultPolicyVersion"
],
"Resource": [
"arn:aws:iam::${Account:Id}:policy/policy1",
"arn:aws:iam::${Account:Id}:policy/policy2"
],
"Effect": "Deny"
}

如何使用Sub Resource 部分中的内部函数语法?替换变量...

编辑:

{
"Action": [
"iam:CreatePolicyVersion",
"iam:DeletePolicy",
"iam:DeletePolicyVersion",
"iam:SetDefaultPolicyVersion"
],
"Resource": [
"arn:aws:iam::${Account:Id}:policy/policy1"
],
"Effect": "Deny"
}

如何引用单个资源?

最佳答案

 {
"Action": [
"iam:CreatePolicyVersion",
"iam:DeletePolicy",
"iam:DeletePolicyVersion",
"iam:SetDefaultPolicyVersion"
],
"Resource": [
{ "Fn::Sub": "arn:aws:iam::${AWS::AccountId}:policy/policy1"},
{ "Fn::Sub": "arn:aws:iam::${AWS::AccountId}:policy/policy2"}
],
"Effect": "Deny"
}

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html

关于json - CloudFormation - 如何使用 Sub 内在函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57513943/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com