

# AWS CLI を使用した Amazon ECS アカウント設定の管理
<a name="account-setting-management-cli"></a>

アカウント設定は、Amazon ECS API、AWS CLI、または SDK を使用して管理することができます。`dualStackIPv6`、`fargateFIPSMode`、`fargateTaskRetirementWaitPeriod`、および `fargateEventWindows` アカウントの設定を表示または変更するために使用できるのは、これらのツールのみです。

**注記**  
デュアルスタックサービスエンドポイントを使用することで、IPv4 と IPv6 の両方を介して AWS CLI、SDK、および Amazon ECS API から Amazon ECS とやり取りできます。詳細については、「[Amazon ECS デュアルスタックエンドポイントの使用](dual-stack-endpoint.md)」を参照してください。

タスク定義に使用できる API アクションの詳細については、「*Amazon Elastic Container Service API リファレンス*」の「[アカウント設定アクション](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/OperationList-query-account.html)」を参照してください。

アカウントのすべてのユーザーまたはロールのデフォルトアカウント設定を変更するには、以下のいずれかのコマンドを使用します。これらの変更は、ユーザーまたはロールがこれらの設定を明示的に上書きしない限り、AWS アカウント全体に適用されます。
+ [put-account-setting-default](https://docs.aws.amazon.com/cli/latest/reference/ecs/put-account-setting-default.html) (AWS CLI)

  ```
  aws ecs put-account-setting-default --name serviceLongArnFormat --value enabled --region us-east-2
  ```

  このコマンドを使用して、他のアカウント設定を変更することもできます。そのためには、`name` パラメータを対応するアカウント設定に置き換えます。
+ [Write-ECSAccountSetting](https://docs.aws.amazon.com/powershell/latest/reference/items/Write-ECSAccountSetting.html) (AWS Tools for Windows PowerShell)

  ```
  Write-ECSAccountSettingDefault -Name serviceLongArnFormat -Value enabled -Region us-east-1 -Force
  ```

**ユーザーアカウントのアカウント設定を変更するには (AWS CLI)**

自分のユーザーのアカウント設定を変更するには、以下のいずれかのコマンドを使用します。ルートユーザーとしてこれらのコマンドを使用する場合、ユーザーまたはロールが対象の設定を明示的に上書きしない限り、この変更内容が AWS アカウント全体に適用されます。
+ [put-account-setting](https://docs.aws.amazon.com/cli/latest/reference/ecs/put-account-setting.html) (AWS CLI)

  ```
  aws ecs put-account-setting --name serviceLongArnFormat --value enabled --region us-east-1
  ```

  このコマンドを使用して、他のアカウント設定を変更することもできます。そのためには、`name` パラメータを対応するアカウント設定に置き換えます。
+ [Write-ECSAccountSetting](https://docs.aws.amazon.com/powershell/latest/reference/items/Write-ECSAccountSetting.html) (AWS Tools for Windows PowerShell)

  ```
  Write-ECSAccountSetting -Name serviceLongArnFormat -Value enabled -Force
  ```

**特定のユーザーまたはロールのアカウント設定を変更するには (AWS CLI)**

特定のユーザーまたはロールのアカウント設定を変更するには、以下のいずれかのコマンドを使用して、リクエストの中でユーザー、ロール、またはルートユーザーの ARN を指定します。
+ [put-account-setting](https://docs.aws.amazon.com/cli/latest/reference/ecs/put-account-setting.html) (AWS CLI)

  ```
  aws ecs put-account-setting --name serviceLongArnFormat --value enabled --principal-arn arn:aws:iam::aws_account_id:user/principalName --region us-east-1
  ```

  このコマンドを使用して、他のアカウント設定を変更することもできます。そのためには、`name` パラメータを対応するアカウント設定に置き換えます。
+ [Write-ECSAccountSetting](https://docs.aws.amazon.com/powershell/latest/reference/items/Write-ECSAccountSetting.html) (AWS Tools for Windows PowerShell)

  ```
  Write-ECSAccountSetting -Name serviceLongArnFormat -Value enabled -PrincipalArn arn:aws:iam::aws_account_id:user/principalName -Region us-east-1 -Force
  ```