本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
的許可和範例 AWS CodeConnections
下列政策陳述式和範例可協助您管理 AWS CodeConnections。
若要了解如何使用這些範例 JSON 政策文件來建立 IAM 身分型政策,請參閱《IAM 使用者指南》中的在 JSON 標籤上建立政策。
範例: AWS CodeConnections 使用 CLI 建立和使用主控台檢視的政策
指定使用 或 AWS CLI SDK 來檢視、建立、標記或刪除連線的角色或使用者,應具有僅限於下列項目的許可。
只具有下列許可,並無法在主控台中完成連線。您需要新增下一節中的許可。
若要使用主控台來檢視可用連線的清單、檢視標籤和使用連線,請使用下列政策。
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ConnectionsFullAccess",
"Effect": "Allow",
"Action": [
"codeconnections:CreateConnection",
"codeconnections:DeleteConnection",
"codeconnections:UseConnection",
"codeconnections:GetConnection",
"codeconnections:ListConnections",
"codeconnections:TagResource",
"codeconnections:ListTagsForResource",
"codeconnections:UntagResource"
],
"Resource": "*"
}
]
}
範例: AWS CodeConnections 使用主控台建立 的政策
指定要管理在主控台中連線的角色或使用者,應具備完成主控台中的連線及建立安裝所需的許可,包括授權供應商進行交握,以及建立供連線使用的安裝。也應該新增 UseConnection
以使用主控台中的連線。請使用下列政策來在主控台中檢視、使用、建立、標記或刪除連線。
從 2024 年 7 月 1 日開始,主控台會在資源 ARN codeconnections
中建立與 的連線。具有兩個服務字首的資源將繼續顯示在主控台中。
對於使用主控台建立的資源,政策陳述式動作必須包含 codestar-connections
做為服務字首,如下列範例所示。
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codestar-connections:CreateConnection",
"codestar-connections:DeleteConnection",
"codestar-connections:GetConnection",
"codestar-connections:ListConnections",
"codestar-connections:GetInstallationUrl",
"codestar-connections:GetIndividualAccessToken",
"codestar-connections:ListInstallationTargets",
"codestar-connections:StartOAuthHandshake",
"codestar-connections:UpdateConnectionInstallation",
"codestar-connections:UseConnection",
"codestar-connections:TagResource",
"codestar-connections:ListTagsForResource",
"codestar-connections:UntagResource"
],
"Resource": [
"*"
]
}
]
}
範例:管理 的管理員層級政策 AWS CodeConnections
在此範例中,您想要授予 AWS 帳戶中的 IAM 使用者 CodeConnections 的完整存取權,讓使用者可以新增、更新和刪除連線。這是一個完整的存取政策,相當於 AWSCodePipeline_FullAccess 受管政策。如同該受管政策,您應該只將這類政策陳述式連接到需要完整管理存取 AWS 您帳戶間連線的 IAM 使用者、群組或角色。
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ConnectionsFullAccess",
"Effect": "Allow",
"Action": [
"codeconnections:CreateConnection",
"codeconnections:DeleteConnection",
"codeconnections:UseConnection",
"codeconnections:GetConnection",
"codeconnections:ListConnections",
"codeconnections:ListInstallationTargets",
"codeconnections:GetInstallationUrl",
"codeconnections:StartOAuthHandshake",
"codeconnections:UpdateConnectionInstallation",
"codeconnections:GetIndividualAccessToken",
"codeconnections:TagResource",
"codeconnections:ListTagsForResource",
"codeconnections:UntagResource"
],
"Resource": "*"
}
]
}
範例:使用 的貢獻者層級政策 AWS CodeConnections
在此範例中,您想要授予 CodeConnections day-to-day使用存取權,例如建立和檢視連線的詳細資訊,但不要授予更具破壞性的動作,例如刪除連線。
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSCodeConnectionsPowerUserAccess",
"Effect": "Allow",
"Action": [
"codeconnections:CreateConnection",
"codeconnections:UseConnection",
"codeconnections:GetConnection",
"codeconnections:ListConnections",
"codeconnections:ListInstallationTargets",
"codeconnections:GetInstallationUrl",
"codeconnections:GetIndividualAccessToken",
"codeconnections:StartOAuthHandshake",
"codeconnections:UpdateConnectionInstallation",
"codeconnections:ListTagsForResource"
],
"Resource": "*"
}
]
}
範例:使用 的read-only-level政策 AWS CodeConnections
在此範例中,您想要授予帳戶中的 IAM 使用者對 AWS 帳戶中連線的唯讀存取權。此範例會示範如何建立允許檢視這些項目的政策。
- JSON
-
-
{
"Version": "2012-10-17",
"Id": "ConnectionsforReadOnly",
"Statement": [
{
"Sid": "ReadsAPIAccess",
"Effect": "Allow",
"Action": [
"codeconnections:GetConnection",
"codeconnections:ListConnections",
"codeconnections:ListInstallationTargets",
"codeconnections:GetInstallationUrl",
"codeconnections:ListTagsForResource"
],
"Resource": "*"
}
]
}
範例:使用 VpcId 內容金鑰限制主機 VPC 許可
在下列範例中,客戶可以使用 VpcId 內容金鑰,將主機的建立或管理限制為具有指定 VPC 的主機。
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"codeconnections:CreateHost",
"codeconnections:UpdateHost"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"codeconnections:VpcId": "vpc-EXAMPLE"
}
}
}
]
}