

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

# AWS Secrets Manager シークレットの JSON 構造
<a name="reference_secret_json_structure"></a>

Secrets Manager シークレットには、最大サイズ 65,536 バイトまでのテキストまたはバイナリを保存できます。

[Lambda 関数によるローテーション](rotate-secrets_lambda.md) を使用する場合、シークレットには、ローテーション関数が想定する特定の JSON フィールドが含まれている必要があります。例えば、データベース認証情報を含むシークレットの場合、ローテーション関数はデータベースに接続して認証情報を更新するため、シークレットにデータベース接続情報が含まれている必要があります。

コンソールを使用して、データベースシークレットのローテーションを編集する場合、シークレットにデータベースを識別する特定の JSON キーと値のペアが含まれている必要があります。Secrets Manager はこれらのフィールドを使用して、データベースをクエリし、ローテーション関数を保存する正しい VPC を検索します。

JSON キー名では大文字と小文字が区別されます。

**Topics**
+ [

## Amazon RDS と Aurora の認証情報
](#reference_secret_json_structure_rds)
+ [

## Amazon Redshift 認証情報
](#reference_secret_json_structure_RS)
+ [

## Amazon Redshift Serverless 認証情報
](#reference_secret_json_structure_RSServerless)
+ [

## Amazon DocumentDB 認証情報
](#reference_secret_json_structure_docdb)
+ [

## Amazon Timestream for InfluxDB のシークレット構造
](#reference_secret_json_structure_TIME)
+ [

## Amazon ElastiCache の認証情報
](#reference_secret_json_structure_ELC)
+ [

## Active Directory 認証情報
](#reference_secret_json_structure_AD)

## Amazon RDS と Aurora の認証情報
<a name="reference_secret_json_structure_rds"></a>

[Secrets Manager が提供するローテーション関数テンプレート](reference_available-rotation-templates.md#RDS_rotation_templates)を使用するには、次の JSON 構造を使用します。キーと値のペアを追加して、例えば、他のリージョンのレプリカデータベースの接続情報を含めることができます。

------
#### [ DB2 ]

Amazon RDS Db2 インスタンスの場合、ユーザーは自分のパスワードを変更できないため、管理者の認証情報を別のシークレットで提供する必要があります。

```
{
  "engine": "db2",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "port": <TCP port number. If not specified, defaults to 3306>,
  "masterarn": "<ARN of the elevated secret>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
}
```

------
#### [ MariaDB ]

```
{
  "engine": "mariadb",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "port": <TCP port number. If not specified, defaults to 3306>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
}
```

------
#### [ MySQL ]

```
{
  "engine": "mysql",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "port": <TCP port number. If not specified, defaults to 3306>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
}
```

------
#### [ Oracle ]

```
{
  "engine": "oracle",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name>",
  "port": <TCP port number. If not specified, defaults to 1521>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
}
```

------
#### [ Postgres ]

```
{
  "engine": "postgres",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to 'postgres'>",
  "port": <TCP port number. If not specified, defaults to 5432>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
}
```

------
#### [ SQLServer ]

```
{
  "engine": "sqlserver",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to 'master'>",
  "port": <TCP port number. If not specified, defaults to 1433>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbInstanceIdentifier": <optional: ID of the instance. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>",
  "dbClusterIdentifier": <optional: ID of the cluster.Alternately, use dbInstanceIdentifier.  Required for configuring rotation in the console.>"
}
```

------

## Amazon Redshift 認証情報
<a name="reference_secret_json_structure_RS"></a>

[Secrets Manager が提供するローテーション関数テンプレート](reference_available-rotation-templates.md#template-redshift)を使用するには、次の JSON 構造を使用します。キーと値のペアを追加して、例えば、他のリージョンのレプリカデータベースの接続情報を含めることができます。

```
{
  "engine": "redshift",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "dbClusterIdentifier": "<optional: database ID. Required for configuring rotation in the console.>"
  "port": <optional: TCP port number. If not specified, defaults to 5439>
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>"
}
```

## Amazon Redshift Serverless 認証情報
<a name="reference_secret_json_structure_RSServerless"></a>

[Secrets Manager が提供するローテーション関数テンプレート](reference_available-rotation-templates.md#template-redshift)を使用するには、次の JSON 構造を使用します。キーと値のペアを追加して、例えば、他のリージョンのレプリカデータベースの接続情報を含めることができます。

```
{
  "engine": "redshift",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "namespaceName": "<optional: namespace name, Required for configuring rotation in the console.> "
  "port": <optional: TCP port number. If not specified, defaults to 5439>
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>"
}
```

## Amazon DocumentDB 認証情報
<a name="reference_secret_json_structure_docdb"></a>

[Secrets Manager が提供するローテーション関数テンプレート](reference_available-rotation-templates.md#NON-RDS_rotation_templates)を使用するには、次の JSON 構造を使用します。キーと値のペアを追加して、例えば、他のリージョンのレプリカデータベースの接続情報を含めることができます。

```
{
  "engine": "mongo",
  "host": "<instance host name/resolvable DNS name>",
  "username": "<username>",
  "password": "<password>",
  "dbname": "<database name. If not specified, defaults to None>",
  "port": <TCP port number. If not specified, defaults to 27017>,
  "ssl": <true|false. If not specified, defaults to false>,
  "masterarn": "<optional: ARN of the elevated secret. Required for the ローテーション戦略: 交代ユーザー.>",
  "dbClusterIdentifier": "<optional: database cluster ID. Alternately, use dbInstanceIdentifier. Required for configuring rotation in the console.>"
  "dbInstanceIdentifier": "<optional: database instance ID. Alternately, use dbClusterIdentifier. Required for configuring rotation in the console.>"
}
```

## Amazon Timestream for InfluxDB のシークレット構造
<a name="reference_secret_json_structure_TIME"></a>

Timestream シークレットをローテーションするには、[Amazon Timestream for InfluxDB](reference_available-rotation-templates.md#template-TimeStream) ローテーションテンプレートを使用できます。

詳細については、「*Amazon Timestream Developer Guide*」の「[How Amazon Timestream for InfluxDB uses secrets](https://docs.aws.amazon.com/timestream/latest/developerguide/timestream-for-influx-security-db-secrets.html)」を参照してください。

ローテーションテンプレートを使用するには、Timestream シークレットが正しい JSON 構造になっている必要があります。詳細については、「*Amazon Timestream Developer Guide*」の「[What's in the secret](https://docs.aws.amazon.com/timestream/latest/developerguide/timestream-for-influx-security-db-secrets.html#timestream-for-influx-security-db-secrets-definition)」を参照してください。

## Amazon ElastiCache の認証情報
<a name="reference_secret_json_structure_ELC"></a>

次の例は、ElastiCache の認証情報を保存するシークレットの JSON 構造を示しています。

```
{
  "password": "<password>",
  "username": "<username>" 
  "user_arn": "ARN of the Amazon EC2 user"
}
```

詳細については、「*Amazon ElastiCache ユーザーガイド*」の「[Automatically rotating passwords for users](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/User-Secrets-Manager.html)」(ユーザーのパスワードの自動ローテーション) を参照してください。

## Active Directory 認証情報
<a name="reference_secret_json_structure_AD"></a>

AWS Directory Service はシークレットを使用して Active Directory 認証情報を保存します。詳細については、「*AWS Directory Service Administration Guide*」の「[Seamlessly join an Amazon EC2 Linux instance to your Managed AD Active Directory](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/seamlessly_join_linux_instance.html)」を参照してください。シームレスなドメイン参加には、次の例にあるキー名が必要です。シームレスなドメイン参加を使用しない場合は、ローテーション関数テンプレートコードで説明されているように、環境変数を使用してシークレット内のキーの名前を変更できます。

Active Directory シークレットをローテーションするには、[Active Directory ローテーションテンプレート](reference_available-rotation-templates.md#template-AD)を使用できます。

------
#### [ Active Directory credential ]

```
{
  "awsSeamlessDomainUsername": "<username>",
  "awsSeamlessDomainPassword": "<password>"
}
```

シークレットをローテーションするには、ドメインディレクトリ ID を含めます。

```
{
  "awsSeamlessDomainDirectoryId": "d-12345abc6e",
  "awsSeamlessDomainUsername": "<username>",
  "awsSeamlessDomainPassword": "<password>"
}
```

シークレットをキータブを含むシークレットと組み合わせて使用する場合は、キータブシークレット ARN を含めます。

```
{
  "awsSeamlessDomainDirectoryId": "d-12345abc6e",
  "awsSeamlessDomainUsername": "<username>",
  "awsSeamlessDomainPassword": "<password>",
  "directoryServiceSecretVersion": 1,
  "schemaVersion": "1.0",
  "keytabArns": [
    "<ARN of child keytab secret 1>,
    "<ARN of child keytab secret 2>,
    "<ARN of child keytab secret 3>,
  ],
  "lastModifiedDateTime": "2021-07-19 17:06:58"
}
```

------
#### [ Active Directory keytab ]

キータブファイルを使用して Amazon EC2 の Active Directory アカウントを認証する方法については、「[Deploying and configuring Active Directory authentication with SQL Server 2017 on Amazon Linux 2](https://aws.amazon.com/blogs/database/deploying-and-configuring-active-directory-authentication-with-sql-server-2017-on-amazon-linux-2/)」を参照してください。

```
{
  "awsSeamlessDomainDirectoryId": "d-12345abc6e",
  "schemaVersion": "1.0",
  "name": "< name>",
  "principals": [
    "aduser@MY.EXAMPLE.COM",
    "MSSQLSvc/test:1433@MY.EXAMPLE.COM"
  ],
  "keytabContents": "<keytab>",
  "parentSecretArn": "<ARN of parent secret>",
  "lastModifiedDateTime": "2021-07-19 17:06:58"
  "version": 1
}
```

------