

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# のアクセス許可と例 AWS CodeConnections
<a name="security_iam_id-based-policy-examples-connections"></a>

以下のポリシーステートメントと例は、 AWS CodeConnectionsの管理に役立ちます。

これらの JSON ポリシードキュメント例を使用して IAM の ID ベースのポリシーを作成する方法については、[IAM ユーザーガイド](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html#access_policies_create-json-editor)の「*JSON タブでのポリシーの作成*」を参照してください。

## 例: CLI AWS CodeConnections で を作成し、コンソールで表示するためのポリシー
<a name="security_iam_id-based-policy-examples-connections-clisdk"></a>

 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 で を作成するためのポリシー
<a name="security_iam_id-based-policy-examples-connections-console"></a>

コンソールで接続を管理するように指定されたロールまたはユーザーは、コンソールで接続を完了し、インストールを作成するために必要なアクセス許可を持っている必要があります。これには、プロバイダーへのハンドシェイクの許可と、使用する接続用のインストールの作成が含まれます。`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
<a name="security_iam_id-based-policy-examples-connections-fullaccess"></a>

この例では、 AWS アカウントの IAM ユーザーに CodeConnections へのフルアクセスを付与して、ユーザーが接続を追加、更新、削除できるようにします。これはフルアクセスポリシーであり、**AWSCodePipeline\$1FullAccess** 管理ポリシーと同等です。その管理ポリシーと同様に、この種のポリシーステートメントは、 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
<a name="security_iam_id-based-policy-examples-connections-contributor"></a>

この例では、接続の詳細の作成や表示など、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
<a name="security_iam_id-based-policy-examples-connections-readonly"></a>

この例では、アカウントの 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": "*"
        }
    ]
}
```

------<a name="security_iam_id-based-policy-examples-connections-use"></a>

## 例: **VpcId** コンテキストキーを使用してホスト VPC アクセス許可を制限する
<a name="security_iam_id-based-policy-examples-connections-vpc"></a>

次の例では、お客様は **VpcId** コンテキストキーを使用して、ホストの作成または管理を、指定された VPC を持つホストに制限できます。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "codeconnections:CreateHost",
                "codeconnections:UpdateHost"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "codeconnections:VpcId": "vpc-EXAMPLE"
                }
            }
        }
    ]
}
```

------