John Jerald De Chavez

Setup AWS Accounts

This guide would help you on how to setup your AWS account

Create AWS Account

The first thing you need to do on your AWS is to create an AWS account.

Here are the steps:

The next important step is to set up spend alerts within the console. You want to be alerted when you spend on AWS. To set this up:

Now you will now get an email alert every time you start to accrue any spending!

Manage AWS Accounts with AWS Organization

AWS Organizations is a container that allows you to govern and manage multiple AWS accounts. You may be wondering why you would need multiple AWS accounts. It's generally a good idea to set up all of your production resources in an isolated AWS account. This way, you can limit access to production resources and prevent people from accidentally deploying to production when they meant to deploy to their development account.

For this guide, we'll have three AWS accounts inside of AWS Organization:

Create AWS Organization

To create the AWS Organization, search for "Organizations" in the AWS Management Console and click "Create an Organization." This will place your management account in an Organizational Unit (OU) within the root of the organization.

Organizational Units are a way to structure your AWS accounts like a file tree and set up granular permissions for individual groups of accounts. For our simple setup, we'll keep all our accounts in the root OU.

Adding Accounts to the Organization

Next, we need to create our development and production accounts within the organization.

You should now see the management account, development account, and production account within your AWS Organization.

IAM Identify Center

With multiple AWS accounts, managing access can be tricky. IAM Identity Center makes it easier to log in to the console and access your accounts from your development machine. It's also a more secure approach than using long-lived IAM user access keys.

In the AWS Management Console, search for IAM Identity Center and click Enable set it up.

Create IAM User

Once enabled, create a new user by clicking Add user under the Users section. Use your email address as the username and have AWS send you a one-time password setup email.

After accepting the invitation and setting a new password, you'll be prompted to set up multi-factor authentication (MFA). Use an authenticator app or a security key.

As you can see the dashboard of your user doesn't have any functionality. That's why we need to setup Permission Set

Create IAM Permission Set

Next, create a permission set, which defines the permissions a user has in an AWS account. For this example, create an Administrator Access permission set with a 12-hour session duration.

Assign User Permission Set

Assign your user the Administrator Access permission set for each of your three AWS accounts (management, development, and production).

After assigning access, refresh the page, and you'll see all three accounts listed with the "Administrator Access" permission set.

Customize the Access Portal URL

To make the IAM Identity Center URL more friendly, go to the dashboard and edit the "Access Portal URL" under "Settings Summary." Choose a unique subdomain (e.g., jerald.dev).

Now, you can access the IAM Identity Center portal at jerald.dev.awsapps.com.start.

AWS CLI

First we need to intall AWS CLI on your local machine based on your operating system.

After installing the CLI, you'll need to configure it to connect to your AWS accounts through Identity Center. Run the following command to check your current credentials:

aws sts get-caller-identity

This will likely return an error saying "unable to locate credentials" since you haven't set up connectivity yet.

To configure the CLI, you'll need to create an AWS config file. This file will contain the necessary information to connect to your accounts through Identity Center.

Create AWS Config File

Login with AWS SSO

After saving the config file, you can log in to your accounts using the AWS SSO login command:

aws sso login --profile <profile_name>

Replace <profile_name> with dev, prod, or management depending on which account you want to access.

This command will open a browser window where you can authenticate with your Identity Center credentials. Once authenticated, you'll have short-term credentials to interact with the specified AWS account using the CLI.

Verify AWS SSO

To verify that you have access to the account, run the get-caller-identity command with the appropriate profile:

aws sts get-caller-identity --profile <profile_name>

This should return the account ID and other details, confirming that you have successfully configured the CLI to access your AWS accounts through Identity Center.

With the AWS CLI configured, you can now execute various AWS commands and interact with your accounts directly from your local machine. This setup allows you to deploy applications, manage resources, and perform other AWS operations seamlessly.