Skip to content
GitHubXDiscordRSS

User

Learn how to create, update, and manage AWS IAM Users using Alchemy Cloud Control.

The User resource lets you manage AWS IAM Users and their associated permissions, policies, and attributes.

Create a basic IAM user with a username and a path, including a managed policy.

import AWS from "alchemy/aws/control";
const basicUser = await AWS.IAM.User("basicUser", {
UserName: "john.doe",
Path: "/users/",
ManagedPolicyArns: [
"arn:aws:iam::aws:policy/ReadOnlyAccess"
]
});

Demonstrate how to attach inline policies to an IAM user.

const userWithPolicies = await AWS.IAM.User("userWithPolicies", {
UserName: "jane.smith",
Path: "/users/",
Policies: [{
PolicyName: "S3AccessPolicy",
PolicyDocument: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Action: "s3:*",
Resource: "*"
}]
})
}]
});

Create an IAM user that is a member of specific groups.

const groupMemberUser = await AWS.IAM.User("groupMemberUser", {
UserName: "alice.johnson",
Groups: ["Developers", "Admins"]
});

Configure a login profile for an IAM user to enable console access.

const userWithLoginProfile = await AWS.IAM.User("userWithLoginProfile", {
UserName: "bob.brown",
LoginProfile: {
Password: "ComplexPassword123!",
PasswordResetRequired: true
}
});

Create a user with tags and a permissions boundary.

const taggedUser = await AWS.IAM.User("taggedUser", {
UserName: "charlie.white",
Tags: [
{ Key: "Department", Value: "Engineering" },
{ Key: "Project", Value: "ProjectX" }
],
PermissionsBoundary: "arn:aws:iam::123456789012:policy/BoundaryPolicy"
});

Demonstrate how to adopt an existing IAM user instead of creating a new one.

const existingUser = await AWS.IAM.User("existingUser", {
UserName: "existing.user",
adopt: true
});