UserProps Struct
Properties for defining an IAM user.
| Source | aws-iam/lib/user.ts |
|---|
Example
const user = new User(this, 'MyUser', { password: SecretValue.plainText('1234') });
const group = new Group(this, 'MyGroup');
const policy = new Policy(this, 'MyPolicy');
policy.attachToUser(user);
group.attachInlinePolicy(policy);
user = User(self, "MyUser", password=SecretValue.plain_text("1234"))
group = Group(self, "MyGroup")
policy = Policy(self, "MyPolicy")
policy.attach_to_user(user)
group.attach_inline_policy(policy)
User user = User.Builder.create(this, "MyUser").password(SecretValue.plainText("1234")).build();
Group group = new Group(this, "MyGroup");
Policy policy = new Policy(this, "MyPolicy");
policy.attachToUser(user);
group.attachInlinePolicy(policy);
// Install: dotnet add package Amazon.CDK.Lib
var user = new User(this, "MyUser", new UserProps { Password = SecretValue.PlainText("1234") });
var group = new Group(this, "MyGroup");
var policy = new Policy(this, "MyPolicy");
policy.AttachToUser(user);
group.AttachInlinePolicy(policy);
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
user := awscdk.NewUser(this, jsii.String("MyUser"), &UserProps{
Password: awscdk.SecretValue_PlainText(jsii.String("1234")),
})
group := awscdk.NewGroup(this, jsii.String("MyGroup"))
policy := awscdk.NewPolicy(this, jsii.String("MyPolicy"))
policy.AttachToUser(user)
group.attachInlinePolicy(policy)
Properties
groupsoptionalIGroup[]groupsoptionaltyping.List[IGroup]groupsoptionalList<IGroup>GroupsoptionalIGroup[]Groupsoptional*[]IGroup #Default: No groups.
You can also use addToGroup to add this user to a group.
managedPoliciesoptionalIManagedPolicy[]managed_policiesoptionaltyping.List[IManagedPolicy]managedPoliciesoptionalList<IManagedPolicy>ManagedPoliciesoptionalIManagedPolicy[]ManagedPoliciesoptional*[]IManagedPolicy #Default: No managed policies.
You can add managed policies later using addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName)).
passwordoptionalSecretValuepasswordoptionalSecretValuepasswordoptionalSecretValuePasswordoptionalSecretValuePasswordoptionalSecretValue #Default: User won't be able to access the management console without a password.
You can use SecretValue.unsafePlainText to specify a password in plain text or use secretsmanager.Secret.fromSecretAttributes to reference a secret in Secrets Manager.
passwordResetRequiredoptionalbooleanpassword_reset_requiredoptionalboolpasswordResetRequiredoptionalBooleanPasswordResetRequiredoptionalboolPasswordResetRequiredoptional*bool = false #If this is set to 'true', you must also specify "initialPassword".
For more information about paths, see IAM Identifiers in the IAM User Guide.
permissionsBoundaryoptionalIManagedPolicypermissions_boundaryoptionalIManagedPolicypermissionsBoundaryoptionalIManagedPolicyPermissionsBoundaryoptionalIManagedPolicyPermissionsBoundaryoptionalIManagedPolicy #Default: No permissions boundary.
notes
A permissions boundary is an advanced feature for using a managed policy to set the maximum permissions that an identity-based policy can grant to an IAM entity. An entity's permissions boundary allows it to perform only the actions that are allowed by both its identity-based policies and its permissions boundaries.
userNameoptionalstringuser_nameoptionalstruserNameoptionalStringUserNameoptionalstringUserNameoptional*string #Default: Generated by CloudFormation (recommended)
notes
For valid values, see the UserName parameter for the CreateUser action in the IAM API Reference. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the user name.
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to acknowledge your template's capabilities. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.