选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

使用 Git 同步使堆栈与 Git 存储库同步的先决条件

聚焦模式
使用 Git 同步使堆栈与 Git 存储库同步的先决条件 - AWS CloudFormation

在使 CloudFormation 堆栈与 Git 存储库同步之前,确认满足以下要求。

Git 存储库

您必须将 Git 存储库托管在以下平台之一上:

存储库可以是公有的,也可以是私有的。您需要通过 Connections 控制台将 Git 存储库连接到 CloudFormation。

CloudFormation 模板

您的 Git 存储库必须包含 CloudFormation 模板文件,且该文件已签入您打算连接到 Git 同步的分支。堆栈部署文件将引用此模板。

IAM 角色

Git 同步需要 IAM 角色。您可以选择在配置 Git 同步时为堆栈创建 IAM 角色,也可以使用现有角色。

注意

自动生成的 IAM 角色仅将权限应用于为其生成角色的堆栈。要重复使用自动生成的 IAM 角色,必须编辑新堆栈的角色。

所需的权限

为 Git 同步提供的 IAM 角色需要以下权限:

注意

上述所需权限会自动添加到 Git 同步生成的 IAM 角色中。

以下示例 IAM 角色包括 Git 同步的必备权限。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "SyncToCloudFormation", "Effect": "Allow", "Action": [ "cloudformation:CreateChangeSet", "cloudformation:DeleteChangeSet", "cloudformation:DescribeChangeSet", "cloudformation:DescribeStackEvents", "cloudformation:DescribeStacks", "cloudformation:ExecuteChangeSet", "cloudformation:GetTemplate", "cloudformation:ListChangeSets", "cloudformation:ListStacks", "cloudformation:ValidateTemplate" ], "Resource": "*" }, { "Sid": "PolicyForManagedRules", "Effect": "Allow", "Action": [ "events:PutRule", "events:PutTargets" ], "Resource": "*", "Condition": { "StringEquals": { "events:ManagedBy": ["cloudformation.sync.codeconnections.amazonaws.com"] } } }, { "Sid": "PolicyForDescribingRule", "Effect": "Allow", "Action": "events:DescribeRule", "Resource": "*" } ] }

信任策略

Git 同步需要以下信任策略才能连接到 Git 存储库:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "CfnGitSyncTrustPolicy", "Effect": "Allow", "Principal": { "Service": "cloudformation.sync.codeconnections.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。