

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

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

# AWS SDKs AWS Cloud9 を使用するためのコード例
<a name="cloud9_code_examples"></a>

次のコード例は、 AWS Software Development Kit (SDK) AWS Cloud9 で を使用する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

**その他のリソース**
+  **[AWS Cloud9 ユーザーガイド](https://docs.aws.amazon.com/cloud9/latest/user-guide/welcome.html)** – 詳細については、「」を参照してください AWS Cloud9。
+ **[AWS Cloud9 API リファレンス](https://docs.aws.amazon.com/cloud9/latest/APIReference/Welcome.html)** – 使用可能なすべての AWS Cloud9 アクションに関する詳細。
+ **[AWS デベロッパーセンター](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23)** – カテゴリまたは全文検索でフィルタリングできるコード例。
+ **[AWS SDK の例](https://github.com/awsdocs/aws-doc-sdk-examples)** – 完全なコードを優先言語で含む GitHub リポジトリ。コードの設定と実行に関する説明が記載されています。

**Contents**
+ [基本](cloud9_code_examples_basics.md)
  + [アクション](cloud9_code_examples_actions.md)
    + [`CreateEnvironmentEc2`](cloud9_example_cloud9_CreateEnvironmentEc2_section.md)
    + [`CreateEnvironmentMembership`](cloud9_example_cloud9_CreateEnvironmentMembership_section.md)
    + [`DeleteEnvironment`](cloud9_example_cloud9_DeleteEnvironment_section.md)
    + [`DeleteEnvironmentMembership`](cloud9_example_cloud9_DeleteEnvironmentMembership_section.md)
    + [`DescribeEnvironmentMemberships`](cloud9_example_cloud9_DescribeEnvironmentMemberships_section.md)
    + [`DescribeEnvironmentStatus`](cloud9_example_cloud9_DescribeEnvironmentStatus_section.md)
    + [`DescribeEnvironments`](cloud9_example_cloud9_DescribeEnvironments_section.md)
    + [`ListEnvironments`](cloud9_example_cloud9_ListEnvironments_section.md)
    + [`UpdateEnvironment`](cloud9_example_cloud9_UpdateEnvironment_section.md)
    + [`UpdateEnvironmentMembership`](cloud9_example_cloud9_UpdateEnvironmentMembership_section.md)

# AWS SDKs AWS Cloud9 を使用するための基本的な例
<a name="cloud9_code_examples_basics"></a>

次のコード例は、 SDKs AWS Cloud9 で AWS の基本を使用する方法を示しています。

**Contents**
+ [アクション](cloud9_code_examples_actions.md)
  + [`CreateEnvironmentEc2`](cloud9_example_cloud9_CreateEnvironmentEc2_section.md)
  + [`CreateEnvironmentMembership`](cloud9_example_cloud9_CreateEnvironmentMembership_section.md)
  + [`DeleteEnvironment`](cloud9_example_cloud9_DeleteEnvironment_section.md)
  + [`DeleteEnvironmentMembership`](cloud9_example_cloud9_DeleteEnvironmentMembership_section.md)
  + [`DescribeEnvironmentMemberships`](cloud9_example_cloud9_DescribeEnvironmentMemberships_section.md)
  + [`DescribeEnvironmentStatus`](cloud9_example_cloud9_DescribeEnvironmentStatus_section.md)
  + [`DescribeEnvironments`](cloud9_example_cloud9_DescribeEnvironments_section.md)
  + [`ListEnvironments`](cloud9_example_cloud9_ListEnvironments_section.md)
  + [`UpdateEnvironment`](cloud9_example_cloud9_UpdateEnvironment_section.md)
  + [`UpdateEnvironmentMembership`](cloud9_example_cloud9_UpdateEnvironmentMembership_section.md)

# AWS SDKs AWS Cloud9 を使用するためのアクション
<a name="cloud9_code_examples_actions"></a>

次のコード例は、 AWS SDKs で個々の AWS Cloud9 アクションを実行する方法を示しています。それぞれの例には、GitHub へのリンクがあり、そこにはコードの設定と実行に関する説明が記載されています。

 以下の例には、最も一般的に使用されるアクションのみ含まれています。詳細な一覧については、「[AWS Cloud9 API リファレンス](https://docs.aws.amazon.com/cloud9/latest/APIReference/Welcome.html)」を参照してください。

**Topics**
+ [`CreateEnvironmentEc2`](cloud9_example_cloud9_CreateEnvironmentEc2_section.md)
+ [`CreateEnvironmentMembership`](cloud9_example_cloud9_CreateEnvironmentMembership_section.md)
+ [`DeleteEnvironment`](cloud9_example_cloud9_DeleteEnvironment_section.md)
+ [`DeleteEnvironmentMembership`](cloud9_example_cloud9_DeleteEnvironmentMembership_section.md)
+ [`DescribeEnvironmentMemberships`](cloud9_example_cloud9_DescribeEnvironmentMemberships_section.md)
+ [`DescribeEnvironmentStatus`](cloud9_example_cloud9_DescribeEnvironmentStatus_section.md)
+ [`DescribeEnvironments`](cloud9_example_cloud9_DescribeEnvironments_section.md)
+ [`ListEnvironments`](cloud9_example_cloud9_ListEnvironments_section.md)
+ [`UpdateEnvironment`](cloud9_example_cloud9_UpdateEnvironment_section.md)
+ [`UpdateEnvironmentMembership`](cloud9_example_cloud9_UpdateEnvironmentMembership_section.md)

# CLI で `CreateEnvironmentEc2` を使用する
<a name="cloud9_example_cloud9_CreateEnvironmentEc2_section"></a>

次のサンプルコードは、`CreateEnvironmentEc2` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 EC2 開発環境を作成するには**  
次の の`create-environment-ec2`例では、指定された設定で AWS Cloud9 開発環境を作成し、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスを起動してから、インスタンスから環境に接続します。  

```
aws cloud9 create-environment-ec2 \
    --name my-demo-env \
    --description "My demonstration development environment." \
    --instance-type t2.micro --image-id amazonlinux-2023-x86_64 \
    --subnet-id subnet-1fab8aEX \
    --automatic-stop-time-minutes 60 \
    --owner-arn arn:aws:iam::123456789012:user/MyDemoUser
```
出力:  

```
{
    "environmentId": "8a34f51ce1e04a08882f1e811bd706EX"
}
```
詳細については、「*AWS Cloud9 ユーザーガイド*」の「[EC2 環境の作成](https://docs.aws.amazon.com/cloud9/latest/user-guide/create-environment-main.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateEnvironmentEc2](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/create-environment-ec2.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された設定で AWS Cloud9 開発環境を作成し、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスを起動してから、インスタンスから環境に接続します。**  

```
New-C9EnvironmentEC2 -Name my-demo-env -AutomaticStopTimeMinutes 60 -Description "My demonstration development environment." -InstanceType t2.micro -OwnerArn arn:aws:iam::123456789012:user/MyDemoUser -SubnetId subnet-d43a46EX
```
**出力:**  

```
ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[CreateEnvironmentEc2](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された設定で AWS Cloud9 開発環境を作成し、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスを起動してから、インスタンスから環境に接続します。**  

```
New-C9EnvironmentEC2 -Name my-demo-env -AutomaticStopTimeMinutes 60 -Description "My demonstration development environment." -InstanceType t2.micro -OwnerArn arn:aws:iam::123456789012:user/MyDemoUser -SubnetId subnet-d43a46EX
```
**出力:**  

```
ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[CreateEnvironmentEc2](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `CreateEnvironmentMembership` を使用する
<a name="cloud9_example_cloud9_CreateEnvironmentMembership_section"></a>

次のサンプルコードは、`CreateEnvironmentMembership` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
**環境メンバーを AWS Cloud9 開発環境に追加するには**  
この例では、指定された環境メンバーを指定された AWS Cloud9 開発環境に追加します。  
コマンド:  

```
aws cloud9 create-environment-membership --environment-id 8a34f51ce1e04a08882f1e811bd706EX --user-arn arn:aws:iam::123456789012:user/AnotherDemoUser --permissions read-write
```
出力:  

```
{
  "membership": {
    "environmentId": "8a34f51ce1e04a08882f1e811bd706EX",
    "userId": "AIDAJ3LOROMOUXTBSU6EX",
    "userArn": "arn:aws:iam::123456789012:user/AnotherDemoUser",
    "permissions": "read-write"
  }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateEnvironmentMembership](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/create-environment-membership.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された環境メンバーを指定された AWS Cloud9 開発環境に追加します。**  

```
New-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission read-write
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-write
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[CreateEnvironmentMembership](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された環境メンバーを指定された AWS Cloud9 開発環境に追加します。**  

```
New-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission read-write
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-write
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[CreateEnvironmentMembership](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DeleteEnvironment` を使用する
<a name="cloud9_example_cloud9_DeleteEnvironment_section"></a>

次のサンプルコードは、`DeleteEnvironment` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境を削除するには**  
この例では、指定された AWS Cloud9 開発環境を削除します。環境が Amazon EC2 インスタンスに接続されている場合、インスタンスを終了します。  
コマンド:  

```
aws cloud9 delete-environment --environment-id 8a34f51ce1e04a08882f1e811bd706EX
```
出力:  

```
None.
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteEnvironment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/delete-environment.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境を削除します。環境が Amazon EC2 インスタンスに接続されている場合、インスタンスも終了します。**  

```
Remove-C9Environment -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DeleteEnvironment](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境を削除します。環境が Amazon EC2 インスタンスに接続されている場合、インスタンスも終了します。**  

```
Remove-C9Environment -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DeleteEnvironment](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DeleteEnvironmentMembership` を使用する
<a name="cloud9_example_cloud9_DeleteEnvironmentMembership_section"></a>

次のサンプルコードは、`DeleteEnvironmentMembership` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境から環境メンバーを削除するには**  
この例では、指定された AWS Cloud9 開発環境から指定された環境メンバーを削除します。  
コマンド:  

```
aws cloud9 delete-environment-membership --environment-id 8a34f51ce1e04a08882f1e811bd706EX --user-arn arn:aws:iam::123456789012:user/AnotherDemoUser
```
出力:  

```
None.
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteEnvironmentMembership](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/delete-environment-membership.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境から指定された環境メンバーを削除します。**  

```
Remove-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DeleteEnvironmentMembership](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境から指定された環境メンバーを削除します。**  

```
Remove-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DeleteEnvironmentMembership](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeEnvironmentMemberships` を使用する
<a name="cloud9_example_cloud9_DescribeEnvironmentMemberships_section"></a>

次のサンプルコードは、`DescribeEnvironmentMemberships` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境の環境メンバーに関する情報を取得するには**  
この例では、指定された AWS Cloud9 開発環境の環境メンバーに関する情報を取得します。  
コマンド:  

```
aws cloud9 describe-environment-memberships --environment-id 8a34f51ce1e04a08882f1e811bd706EX
```
出力:  

```
{
  "memberships": [
    {
      "environmentId": "8a34f51ce1e04a08882f1e811bd706EX",
      "userId": "AIDAJ3LOROMOUXTBSU6EX",
      "userArn": "arn:aws:iam::123456789012:user/AnotherDemoUser",
      "permissions": "read-write"
    },
    {
      "environmentId": "8a34f51ce1e04a08882f1e811bd706EX",
      "userId": "AIDAJNUEDQAQWFELJDLEX",
      "userArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "permissions": "owner"
    }
  ]
}
```
** AWS Cloud9 開発環境の所有者に関する情報を取得するには**  
この例では、指定された AWS Cloud9 開発環境の所有者に関する情報を取得します。  
コマンド:  

```
aws cloud9 describe-environment-memberships --environment-id 8a34f51ce1e04a08882f1e811bd706EX --permissions owner
```
出力:  

```
{
  "memberships": [
    {
      "environmentId": "8a34f51ce1e04a08882f1e811bd706EX",
      "userId": "AIDAJNUEDQAQWFELJDLEX",
      "userArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "permissions": "owner"
    }
  ]
}
```
**multiple AWS Cloud9 開発環境の環境メンバーに関する情報を取得するには**  
この例では、multiple AWS Cloud9 開発環境の指定された環境メンバーに関する情報を取得します。  
コマンド:  

```
aws cloud9 describe-environment-memberships --user-arn arn:aws:iam::123456789012:user/MyDemoUser
```
出力:  

```
{
  "memberships": [
    {
      "environmentId": "10a75714bd494714929e7f5ec4125aEX",
      "lastAccess": 1516213427.0,
      "userId": "AIDAJNUEDQAQWFELJDLEX",
      "userArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "permissions": "owner"
    },
    {
      "environmentId": "1980b80e5f584920801c09086667f0EX",
      "lastAccess": 1516144884.0,
      "userId": "AIDAJNUEDQAQWFELJDLEX",
      "userArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "permissions": "owner"
    }
  ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeEnvironmentMemberships](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/describe-environment-memberships.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境の環境メンバーに関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-write
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX

EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
**例 2: この例では、指定された AWS Cloud9 開発環境の所有者に関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission owner
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
**例 3: この例では、multiple AWS Cloud9 開発環境の指定された環境メンバーに関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -UserArn arn:aws:iam::123456789012:user/MyDemoUser
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/17/2018 7:48:14 PM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX

EnvironmentId : 1980b80e5f584920801c09086667f0EX
LastAccess    : 1/16/2018 11:21:24 PM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeEnvironmentMemberships](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境の環境メンバーに関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-write
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX

EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
**例 2: この例では、指定された AWS Cloud9 開発環境の所有者に関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission owner
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
**例 3: この例では、multiple AWS Cloud9 開発環境の指定された環境メンバーに関する情報を取得します。**  

```
Get-C9EnvironmentMembershipList -UserArn arn:aws:iam::123456789012:user/MyDemoUser
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/17/2018 7:48:14 PM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX

EnvironmentId : 1980b80e5f584920801c09086667f0EX
LastAccess    : 1/16/2018 11:21:24 PM
Permissions   : owner
UserArn       : arn:aws:iam::123456789012:user/MyDemoUser
UserId        : AIDAJ3LOROMOUXTBSU6EX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeEnvironmentMemberships](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeEnvironmentStatus` を使用する
<a name="cloud9_example_cloud9_DescribeEnvironmentStatus_section"></a>

次のサンプルコードは、`DescribeEnvironmentStatus` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境のステータス情報を取得するには**  
この例では、指定された AWS Cloud9 開発環境のステータス情報を取得します。  
コマンド:  

```
aws cloud9 describe-environment-status --environment-id 685f892f431b45c2b28cb69eadcdb0EX
```
出力:  

```
{
  "status": "ready",
  "message": "Environment is ready to use"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeEnvironmentStatus](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/describe-environment-status.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境のステータス情報を取得します。**  

```
Get-C9EnvironmentStatus -EnvironmentId 349c86d4579e4e7298d500ff57a6b2EX
```
**出力:**  

```
Message                     Status
-------                     ------
Environment is ready to use ready
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeEnvironmentStatus](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境のステータス情報を取得します。**  

```
Get-C9EnvironmentStatus -EnvironmentId 349c86d4579e4e7298d500ff57a6b2EX
```
**出力:**  

```
Message                     Status
-------                     ------
Environment is ready to use ready
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeEnvironmentStatus](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeEnvironments` を使用する
<a name="cloud9_example_cloud9_DescribeEnvironments_section"></a>

次のサンプルコードは、`DescribeEnvironments` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境に関する情報を取得するには**  
この例では、指定された AWS Cloud9 開発環境に関する情報を取得します。  
コマンド:  

```
aws cloud9 describe-environments --environment-ids 685f892f431b45c2b28cb69eadcdb0EX 349c86d4579e4e7298d500ff57a6b2EX
```
出力:  

```
{
  "environments": [
    {
      "id": "685f892f431b45c2b28cb69eadcdb0EX",
      "name": "my-demo-ec2-env",
      "description": "Created from CodeStar.",
      "type": "ec2",
      "arn": "arn:aws:cloud9:us-east-1:123456789012:environment:685f892f431b45c2b28cb69eadcdb0EX",
      "ownerArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "lifecycle": {
        "status": "CREATED"
      }
    },
    {
      "id": "349c86d4579e4e7298d500ff57a6b2EX",
      "name": my-demo-ssh-env",
      "description": "",
      "type": "ssh",
      "arn": "arn:aws:cloud9:us-east-1:123456789012:environment:349c86d4579e4e7298d500ff57a6b2EX",
      "ownerArn": "arn:aws:iam::123456789012:user/MyDemoUser",
      "lifecycle": {
        "status": "CREATED"
      }
    }
  ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeEnvironments](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/describe-environments.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境に関する情報を取得します。**  

```
Get-C9EnvironmentData -EnvironmentId 685f892f431b45c2b28cb69eadcdb0EX,1980b80e5f584920801c09086667f0EX
```
**出力:**  

```
Arn         : arn:aws:cloud9:us-east-1:123456789012:environment:685f892f431b45c2b28cb69eadcdb0EX
Description : Created from CodeStar.
Id          : 685f892f431b45c2b28cb69eadcdb0EX
Lifecycle   : Amazon.Cloud9.Model.EnvironmentLifecycle
Name        : my-demo-ec2-env
OwnerArn    : arn:aws:iam::123456789012:user/MyDemoUser
Type        : ec2

Arn         : arn:aws:cloud9:us-east-1:123456789012:environment:1980b80e5f584920801c09086667f0EX
Description :
Id          : 1980b80e5f584920801c09086667f0EX
Lifecycle   : Amazon.Cloud9.Model.EnvironmentLifecycle
Name        : my-demo-ssh-env
OwnerArn    : arn:aws:iam::123456789012:user/MyDemoUser
Type        : ssh
```
**例 2: この例では、指定された AWS Cloud9 開発環境のライフサイクルステータスに関する情報を取得します。**  

```
(Get-C9EnvironmentData -EnvironmentId 685f892f431b45c2b28cb69eadcdb0EX).Lifecycle
```
**出力:**  

```
FailureResource Reason Status
--------------- ------ ------
                       CREATED
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeEnvironments](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境に関する情報を取得します。**  

```
Get-C9EnvironmentData -EnvironmentId 685f892f431b45c2b28cb69eadcdb0EX,1980b80e5f584920801c09086667f0EX
```
**出力:**  

```
Arn         : arn:aws:cloud9:us-east-1:123456789012:environment:685f892f431b45c2b28cb69eadcdb0EX
Description : Created from CodeStar.
Id          : 685f892f431b45c2b28cb69eadcdb0EX
Lifecycle   : Amazon.Cloud9.Model.EnvironmentLifecycle
Name        : my-demo-ec2-env
OwnerArn    : arn:aws:iam::123456789012:user/MyDemoUser
Type        : ec2

Arn         : arn:aws:cloud9:us-east-1:123456789012:environment:1980b80e5f584920801c09086667f0EX
Description :
Id          : 1980b80e5f584920801c09086667f0EX
Lifecycle   : Amazon.Cloud9.Model.EnvironmentLifecycle
Name        : my-demo-ssh-env
OwnerArn    : arn:aws:iam::123456789012:user/MyDemoUser
Type        : ssh
```
**例 2: この例では、指定された AWS Cloud9 開発環境のライフサイクルステータスに関する情報を取得します。**  

```
(Get-C9EnvironmentData -EnvironmentId 685f892f431b45c2b28cb69eadcdb0EX).Lifecycle
```
**出力:**  

```
FailureResource Reason Status
--------------- ------ ------
                       CREATED
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeEnvironments](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListEnvironments` を使用する
<a name="cloud9_example_cloud9_ListEnvironments_section"></a>

次のサンプルコードは、`ListEnvironments` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
**利用可能な AWS Cloud9 開発環境識別子のリストを取得するには**  
この例では、利用可能な AWS Cloud9 開発環境識別子のリストを取得します。  
コマンド:  

```
aws cloud9 list-environments
```
出力:  

```
{
  "environmentIds": [
    "685f892f431b45c2b28cb69eadcdb0EX",
    "1980b80e5f584920801c09086667f0EX"
  ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListEnvironments](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/list-environments.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、使用可能な AWS Cloud9 開発環境識別子のリストを取得します。**  

```
Get-C9EnvironmentList
```
**出力:**  

```
685f892f431b45c2b28cb69eadcdb0EX
1980b80e5f584920801c09086667f0EX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListEnvironments](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、使用可能な AWS Cloud9 開発環境識別子のリストを取得します。**  

```
Get-C9EnvironmentList
```
**出力:**  

```
685f892f431b45c2b28cb69eadcdb0EX
1980b80e5f584920801c09086667f0EX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[ListEnvironments](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `UpdateEnvironment` を使用する
<a name="cloud9_example_cloud9_UpdateEnvironment_section"></a>

次のサンプルコードは、`UpdateEnvironment` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
**既存の AWS Cloud9 開発環境の設定を変更するには**  
この例では、指定された既存の AWS Cloud9 開発環境の指定された設定を変更します。  
コマンド:  

```
aws cloud9 update-environment --environment-id 8a34f51ce1e04a08882f1e811bd706EX --name my-changed-demo-env --description "My changed demonstration development environment."
```
出力:  

```
None.
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateEnvironment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/update-environment.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された既存の AWS Cloud9 開発環境の指定された設定を変更します。**  

```
Update-C9Environment -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Description "My changed demonstration development environment." -Name my-changed-demo-env
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[UpdateEnvironment](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された既存の AWS Cloud9 開発環境の指定された設定を変更します。**  

```
Update-C9Environment -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Description "My changed demonstration development environment." -Name my-changed-demo-env
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[UpdateEnvironment](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `UpdateEnvironmentMembership` を使用する
<a name="cloud9_example_cloud9_UpdateEnvironmentMembership_section"></a>

次のサンプルコードは、`UpdateEnvironmentMembership` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS Cloud9 開発環境の既存の環境メンバーの設定を変更するには**  
この例では、指定された AWS Cloud9 開発環境の指定された既存の環境メンバーの設定を変更します。  
コマンド:  

```
aws cloud9 update-environment-membership --environment-id 8a34f51ce1e04a08882f1e811bd706EX --user-arn arn:aws:iam::123456789012:user/AnotherDemoUser --permissions read-only
```
出力:  

```
{
  "membership": {
    "environmentId": "8a34f51ce1e04a08882f1e811bd706EX",
    "userId": "AIDAJ3LOROMOUXTBSU6EX",
    "userArn": "arn:aws:iam::123456789012:user/AnotherDemoUser",
    "permissions": "read-only"
  }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateEnvironmentMembership](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloud9/update-environment-membership.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: この例では、指定された AWS Cloud9 開発環境の指定された既存の環境メンバーの設定を変更します。**  

```
Update-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission read-only
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-only
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[UpdateEnvironmentMembership](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Cloud9 開発環境の指定された既存の環境メンバーの設定を変更します。**  

```
Update-C9EnvironmentMembership -UserArn arn:aws:iam::123456789012:user/AnotherDemoUser -EnvironmentId ffd88420d4824eeeaeaa8a04bfde8cEX -Permission read-only
```
**出力:**  

```
EnvironmentId : ffd88420d4824eeeaeaa8a04bfde8cEX
LastAccess    : 1/1/0001 12:00:00 AM
Permissions   : read-only
UserArn       : arn:aws:iam::123456789012:user/AnotherDemoUser
UserId        : AIDAJ3BA6O2FMJWCWXHEX
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[UpdateEnvironmentMembership](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------