[英]AWS CloudFormation: How to specify a bucket from another AWS account for Lambda code?
[英]How to run CloudFormation for a specific AWS Account
我正在嘗試為自定義管理的策略創建一個 CloudFormation 模板,每當我運行該模板時,它都會在我指定的帳戶中創建該策略。
例如,我有 10 個 AWS 賬戶,我想在我們的主賬戶中創建一個模板,您只需在其中輸入賬戶 ID 和 JSON,CloudFormation 就會為您創建模板。 這是我到目前為止所擁有的(這是行不通的)
AWSTemplateFormatVersion: "2010-09-09"
Description: "This cloudformation template will create a managed policy in a perticular account"
#####################
# Define Parameters
#####################
Parameters:
PolicyName:
Type: String
Description: The name that will be applied to the custom policy.
PolicyDescription:
Type: String
Description: Type a description for this policy. This can NOT be changed after initial assignment.
PolicyJson:
Type: Json
Description: Type permission for this policy in JSON format
AccountID:
Type: String
Description: Enter the account ID where you want to create this policy
#####################
# Define Resources
#####################
Resources:
# ---------------------
# Define Policy Resource
# ---------------------
ManagedPolicy:
Type: "AWS::IAM::ManagedPolicy"
Properties:
ManagedPolicyName: !Ref PolicyName
Description: !Ref PolicyDescription
Path: "/"
PolicyDocument: !RefPolicyJson
#####################
# Define Outputs:
#####################
Outputs:
PolicyName:
Description: The name of the newly created managed policy
Value: !Ref PolicyName
問題:
我正在關注https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html文檔以解決我的問題。
我們希望每當有人運行該模板時,都會為他們提供輸入字段,他們可以在其中寫入策略名稱、描述、創建策略的帳戶以及權限的 Json。 Cloudformation 應該為他們創建它並將策略 ARN 返回為 output
您必須使用堆棧集來進行模板的多帳戶部署:
AWS CloudFormation StackSets 擴展了堆棧的功能,使您能夠通過一次操作跨多個賬戶和 AWS 區域創建、更新或刪除堆棧。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.