View a markdown version of this page

Use CreateEnvironmentMembership with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use CreateEnvironmentMembership with a CLI

The following code examples show how to use CreateEnvironmentMembership.

CLI
AWS CLI

To add an environment member to an AWS Cloud9 development environment

The following create-environment-membership example adds the specified environment member to the specified AWS Cloud9 development environment.

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

Output:

{ "membership": { "environmentId": "8a34f51ce1e04a08882f1e811bd706EX", "userId": "AIDAJ3LOROMOUXTBSU6EX", "userArn": "arn:aws:iam::123456789012:user/AnotherDemoUser", "permissions": "read-write" } }

For more information, see Working with shared environment in AWS Cloud9 in the AWS Cloud9 User Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example adds the specified environment member to the specified AWS Cloud9 development environment.

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

Output:

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

Example 1: This example adds the specified environment member to the specified AWS Cloud9 development environment.

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

Output:

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