Experimental
@aws-cdk/aws-cloud9-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
Owner Class
An environment owner.
Example
ts
import * as iam from 'aws-cdk-lib/aws-iam';
declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
vpc,
imageId: cloud9.ImageId.AMAZON_LINUX_2,
owner: cloud9.Owner.federatedUser(Stack.of(this).account, "Admin/johndoe")
})
python
import aws_cdk.aws_iam as iam
# vpc: ec2.Vpc
cloud9.Ec2Environment(self, "C9Env",
vpc=vpc,
image_id=cloud9.ImageId.AMAZON_LINUX_2,
owner=cloud9.Owner.federated_user(Stack.of(self).account, "Admin/johndoe")
)
java
import software.amazon.awscdk.services.iam.*;
Vpc vpc;
Ec2Environment.Builder.create(this, "C9Env")
.vpc(vpc)
.imageId(ImageId.AMAZON_LINUX_2)
.owner(Owner.federatedUser(Stack.of(this).getAccount(), "Admin/johndoe"))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Cloud9.Alpha
using Amazon.CDK.AWS.IAM;
Vpc vpc;
new Ec2Environment(this, "C9Env", new Ec2EnvironmentProps {
Vpc = vpc,
ImageId = ImageId.AMAZON_LINUX_2,
Owner = Owner.FederatedUser(Stack.Of(this).Account, "Admin/johndoe")
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkcloud9alpha/v2
import iam "github.com/aws/aws-cdk-go/awscdk"
var vpc Vpc
cloud9.NewEc2Environment(this, jsii.String("C9Env"), &Ec2EnvironmentProps{
Vpc: Vpc,
ImageId: cloud9.ImageId_AMAZON_LINUX_2,
Owner: cloud9.Owner_FederatedUser(awscdk.*stack_Of(this).Account, jsii.String("Admin/johndoe")),
})
Properties
of environment owner.
Methods
accountRoot(accountId: string): Owner // chainable@staticmethod def account_root(account_id: str) -> Ownerpublic static Owner accountRoot(String accountId)public static Owner AccountRoot(string accountId)func AccountRoot(AccountId *string) Ownerstatic#Make the Account Root User the environment owner (not recommended).
1 parameter
Parameters
accountIdaccount_idaccountIdaccountIdAccountId— the AccountId to use as the environment owner.
assumedRole(accountId: string, roleName: string): Owner // chainable@staticmethod def assumed_role(account_id: str, role_name: str) -> Ownerpublic static Owner assumedRole(String accountId, String roleName)public static Owner AssumedRole(string accountId, string roleName)func AssumedRole(AccountId *string, RoleName *string) Ownerstatic#Make an IAM assumed role the environment owner.
2 parameters
Parameters
accountIdaccount_idaccountIdaccountIdAccountId— The account id of the target account.roleNamerole_nameroleNameroleNameRoleName— The name of the assumed role.
federatedUser(accountId: string, userName: string): Owner // chainable@staticmethod def federated_user(account_id: str, user_name: str) -> Ownerpublic static Owner federatedUser(String accountId, String userName)public static Owner FederatedUser(string accountId, string userName)func FederatedUser(AccountId *string, UserName *string) Ownerstatic#Make an IAM federated user the environment owner.
2 parameters
Parameters
accountIdaccount_idaccountIdaccountIdAccountId— The AccountId of the target account.userNameuser_nameuserNameuserNameUserName— The name of the federated user.
user(user: IUser): Owner // chainable@staticmethod def user(user: IUser) -> Ownerpublic static Owner user(IUser user)public static Owner User(IUser user)func User(User IUser) Ownerstatic#Make an IAM user the environment owner.
User need to have AWSCloud9Administrator permissions
1 parameter
Parameters
useruseruseruserUser— the User object to use as the environment owner.