

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

# リソース名とタグを使用したファイングレインアクセスコントロール
<a name="CHAP_Security.FineGrainedAccess"></a>

Amazon リソースネーム (ARNs) に基づくリソース名とリソースタグを使用して、 AWS DMS リソースへのアクセスを管理できます。これを行うには、許可されたアクションを定義するか、条件ステートメントを IAM ポリシーに含めます。

## リソース名を使用したアクセスの制御
<a name="CHAP_Security.FineGrainedAccess.ResourceName"></a>

IAM ユーザーアカウントを作成し、 AWS DMS リソースの ARN に基づいてポリシーを割り当てることができます。

次のポリシーは、ARN *arn:aws:dms:us-east-1:152683116:rep:DOH67ZTOXGLIXMIHKITV* を使用した AWS DMS レプリケーションインスタンスへのアクセスを拒否します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "arn:aws:dms:us-east-1:111122223333:rep:DOH67ZTOXGLIXMIHKITV"
        }
    ]
}
```

------

たとえば、このポリシーが有効になっていると、次のコマンドは失敗します。

```
$ aws dms delete-replication-instance 
   --replication-instance-arn "arn:aws:dms:us-east-1:152683116:rep:DOH67ZTOXGLIXMIHKITV"

A client error (AccessDeniedException) occurred when calling the DeleteReplicationInstance 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:DeleteReplicationInstance on resource: arn:aws:dms:us-east-1:152683116:rep:DOH67ZTOXGLIXMIHKITV

$ aws dms modify-replication-instance 
   --replication-instance-arn "arn:aws:dms:us-east-1:152683116:rep:DOH67ZTOXGLIXMIHKITV"

A client error (AccessDeniedException) occurred when calling the ModifyReplicationInstance 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:ModifyReplicationInstance on resource: arn:aws:dms:us-east-1:152683116:rep:DOH67ZTOXGLIXMIHKITV
```

 AWS DMS エンドポイントとレプリケーションタスクへのアクセスを制限する IAM ポリシーを指定することもできます。

次のポリシーは、 AWS DMS エンドポイントの ARN を使用してエンドポイントへのアクセスを制限します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "arn:aws:dms:us-east-1:111122223333:endpoint:D6E37YBXTNHOA6XRQSZCUGX"
        }
    ]
}
```

------

たとえば、次のコマンドは、エンドポイントの ARN を使用するポリシーが有効になっていると失敗します。

```
$ aws dms delete-endpoint 
   --endpoint-arn "arn:aws:dms:us-east-1:152683116:endpoint:D6E37YBXTNHOA6XRQSZCUGX"

A client error (AccessDeniedException) occurred when calling the DeleteEndpoint operation: 
User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: dms:DeleteEndpoint 
on resource: arn:aws:dms:us-east-1:152683116:endpoint:D6E37YBXTNHOA6XRQSZCUGX

$ aws dms modify-endpoint 
   --endpoint-arn "arn:aws:dms:us-east-1:152683116:endpoint:D6E37YBXTNHOA6XRQSZCUGX"     

A client error (AccessDeniedException) occurred when calling the ModifyEndpoint operation: 
User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: dms:ModifyEndpoint 
on resource: arn:aws:dms:us-east-1:152683116:endpoint:D6E37YBXTNHOA6XRQSZCUGX
```

次のポリシーは、 AWS DMS タスクの ARN を使用して タスクへのアクセスを制限します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "arn:aws:dms:us-east-1:111122223333:task:UO3YR4N47DXH3ATT4YMWOIT"
        }
    ]
}
```

------

たとえば、次のコマンドは、タスクの ARN を使用するポリシーが有効になっていると失敗します。

```
$ aws dms delete-replication-task 
   --replication-task-arn "arn:aws:dms:us-east-1:152683116:task:UO3YR4N47DXH3ATT4YMWOIT"

A client error (AccessDeniedException) occurred when calling the DeleteReplicationTask operation: 
User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: dms:DeleteReplicationTask 
on resource: arn:aws:dms:us-east-1:152683116:task:UO3YR4N47DXH3ATT4YMWOIT
```

## タグを使用したアクセスへのコントロール
<a name="CHAP_Security.FineGrainedAccess.Tags"></a>

AWS DMS は、追加のタグ付け要件なしでユーザー定義ポリシーで使用できる共通のキーと値のペアのセットを定義します。 AWS DMS リソースのタグ付けの詳細については、「」を参照してください[AWS Database Migration Service でのリソースへのタグ付け](CHAP_Tagging.md)。

以下は、 で使用できる標準タグの一覧です AWS DMS。
+  aws:CurrentTime – リクエストの日時を表し、一時的な条件に基づいてアクセス制限を許可します。
+  aws:EpochTime – このタグは上記の aws:CurrentTime タグと似ていますが、現在の時刻が Unix エポックからの経過秒数で表されることが異なります。
+  aws:MultiFactorAuthPresent – これはリクエストが多要素認証を介して署名されたかどうかを示すブールタグです。
+  aws:MultiFactorAuthAge – 多要素認証トークンの期間 (秒) へのアクセスを提供します。
+  aws:principaltype - 現在のリクエストに対するプリンシパルのタイプ (ユーザー、アカウント、フェデレーティッドユーザーなど) へのアクセスを提供します。
+  aws:SourceIp - リクエストを発行するユーザーのソース IP アドレスを表します。
+  aws:UserAgent – リソースをリクエストしているクライアントアプリケーションに関する情報を提供します。
+  aws:userid – リクエストを発行しているユーザーの ID へのアクセスを提供します。
+  aws:username – リクエストを発行しているユーザーの名前へのアクセスを提供します。
+  dms:InstanceClass – レプリケーション インスタンスホストのコンピューティングサイズへのアクセスを提供します。
+  dms:StorageSize - ストレージボリュームサイズ (GB) へのアクセスを提供します。

独自のタグを定義することもできます。カスタマー定義タグは、 AWS タグ付けサービスに保持される単純なキーと値のペアです。このタグを AWS DMS リソース (レプリケーション インスタンス、エンドポイント、タスクを含む) に追加できます。これらのタグはポリシーの IAM「条件」ステートメントを使用してマッチングされ、特定の条件付きタグを使用して参照されます。タグキーにはプレフィックスとして「dms」、リソースタイプ、および「tag」が付きます。以下にタグ形式を示します。

```
dms:{resource type}-tag/{tag key}={tag value}
```

たとえば、タグ「stage=production」を含むレプリケーション インスタンスに対してのみ API コールの成功を許可するポリシーを定義するとします。次の条件ステートメントは、指定されたタグを持つリソースに一致します。

```
"Condition":
{
    "streq":
        {
            "dms:rep-tag/stage":"production"
        }
}
```

次のタグを、このポリシー条件に一致するレプリケーション インスタンスに追加します。

```
stage production
```

 AWS DMS リソースに既に割り当てられているタグに加えて、ポリシーを記述して、特定のリソースに適用できるタグキーと値を制限することもできます。この場合、タグのプレフィックスは「req」です。

たとえば、次のポリシーステートメントは、ユーザーが特定のリソースに割り当てることができるタグを、許可される値の特定のリストに制限します。

```
 "Condition":
{
    "streq":
        {
            "dms:rep-tag/stage": [ "production", "development", "testing" ]
        }
}
```

次のポリシー例では、 AWS DMS リソースタグに基づいて リソースへのアクセスを制限します。

次のポリシーでは、タグの値が「Desktop」、タグキーが「Env」のレプリケーション インスタンスへのアクセスを制限します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "dms:rep-tag/Env": [
                        "Desktop"
                    ]
                }
            }
        }
    ]
}
```

------

次のコマンドは、タグの値が「Desktop」で、タグキーが「Env」の場合にアクセスを制限する IAM ポリシーに基づいて、成功または失敗します。

```
$ aws dms list-tags-for-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN 
   --endpoint-url http://localhost:8000                                   
{
    "TagList": [
        {
            "Value": "Desktop", 
            "Key": "Env"
        }
    ]
}

$ aws dms delete-replication-instance 
   --replication-instance-arn "arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN"
A client error (AccessDeniedException) occurred when calling the DeleteReplicationInstance 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:DeleteReplicationInstance on resource: arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN

$ aws dms modify-replication-instance 
   --replication-instance-arn "arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN" 

A client error (AccessDeniedException) occurred when calling the ModifyReplicationInstance 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:ModifyReplicationInstance on resource: arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN

$ aws dms add-tags-to-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN 
   --tags Key=CostCenter,Value=1234 

A client error (AccessDeniedException) occurred when calling the AddTagsToResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:AddTagsToResource on resource: arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN

$ aws dms remove-tags-from-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN 
   --tag-keys Env             

A client error (AccessDeniedException) occurred when calling the RemoveTagsFromResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:RemoveTagsFromResource on resource: arn:aws:dms:us-east-1:152683116:rep:46DHOU7JOJYOJXWDOZNFEN
```

次のポリシーは、タグ値が「Desktop」で、タグキーが「Env」である AWS DMS エンドポイントへのアクセスを制限します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "dms:endpoint-tag/Env": [
                        "Desktop"
                    ]
                }
            }
        }
    ]
}
```

------

次のコマンドは、タグの値が「Desktop」で、タグキーが「Env」の場合にアクセスを制限する IAM ポリシーに基づいて、成功または失敗します。

```
$ aws dms list-tags-for-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I
{
    "TagList": [
        {
            "Value": "Desktop", 
            "Key": "Env"
        }
    ]
}

$ aws dms delete-endpoint 
   --endpoint-arn "arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I"

A client error (AccessDeniedException) occurred when calling the DeleteEndpoint 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:DeleteEndpoint on resource: arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I

$ aws dms modify-endpoint 
   --endpoint-arn "arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I"    

A client error (AccessDeniedException) occurred when calling the ModifyEndpoint 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:ModifyEndpoint on resource: arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I

$ aws dms add-tags-to-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I 
   --tags Key=CostCenter,Value=1234

A client error (AccessDeniedException) occurred when calling the AddTagsToResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:AddTagsToResource on resource: arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I

$ aws dms remove-tags-from-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I 
   --tag-keys Env

A client error (AccessDeniedException) occurred when calling the RemoveTagsFromResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:RemoveTagsFromResource on resource: arn:aws:dms:us-east-1:152683116:endpoint:J2YCZPNGOLFY52344IZWA6I
```

次のポリシーでは、タグの値が「Desktop」、タグキーが「Env」のレプリケーションタスクへのアクセスを制限します。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "dms:*"
            ],
            "Effect": "Deny",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "dms:task-tag/Env": [
                        "Desktop"
                    ]
                }
            }
        }
    ]
}
```

------

次のコマンドは、タグの値が「Desktop」で、タグキーが「Env」の場合にアクセスを制限する IAM ポリシーに基づいて、成功または失敗します。

```
$ aws dms list-tags-for-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3
{
    "TagList": [
        {
            "Value": "Desktop", 
            "Key": "Env"
        }
    ]
}

$ aws dms delete-replication-task 
   --replication-task-arn "arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3"

A client error (AccessDeniedException) occurred when calling the DeleteReplicationTask 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:DeleteReplicationTask on resource: arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3

$ aws dms add-tags-to-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3 
   --tags Key=CostCenter,Value=1234

A client error (AccessDeniedException) occurred when calling the AddTagsToResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:AddTagsToResource on resource: arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3

$ aws dms remove-tags-from-resource 
   --resource-name arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3 
   --tag-keys Env

A client error (AccessDeniedException) occurred when calling the RemoveTagsFromResource 
operation: User: arn:aws:iam::152683116:user/dmstestusr is not authorized to perform: 
dms:RemoveTagsFromResource on resource: arn:aws:dms:us-east-1:152683116:task:RB7N24J2XBUPS3RFABZTG3
```