InitUser

class aws_cdk.aws_ec2.InitUser(user_name, *, groups=None, home_dir=None, user_id=None)

Bases: aws_cdk.aws_ec2.InitElement

Create Linux/UNIX users and to assign user IDs.

Users are created as non-interactive system users with a shell of /sbin/nologin. This is by design and cannot be modified.

Not supported for Windows systems.

Parameters
  • user_name (str) –

  • groups (Optional[List[str]]) – A list of group names. The user will be added to each group in the list. Default: the user is not associated with any groups.

  • home_dir (Optional[str]) – The user’s home directory. Default: assigned by the OS

  • user_id (Union[int, float, None]) – A user ID. The creation process fails if the user name exists with a different user ID. If the user ID is already assigned to an existing user the operating system may reject the creation request. Default: assigned by the OS

Attributes

element_type

Returns the init element type for this element.

Return type

str

Static Methods

classmethod from_name(user_name, *, groups=None, home_dir=None, user_id=None)

Create a user from user name.

Parameters
  • user_name (str) –

  • groups (Optional[List[str]]) – A list of group names. The user will be added to each group in the list. Default: the user is not associated with any groups.

  • home_dir (Optional[str]) – The user’s home directory. Default: assigned by the OS

  • user_id (Union[int, float, None]) – A user ID. The creation process fails if the user name exists with a different user ID. If the user ID is already assigned to an existing user the operating system may reject the creation request. Default: assigned by the OS

Return type

InitUser