Create an IAM User and Set Up Billing Alerts for Your AWS Account
Tags: aws
Published: 2024-06-26 07:27:06


![IAM & Cost](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/amiyh41dfj6ms8osbufq.png)
**AWS Identity and Access Management (IAM)** is used to enhance security and manage access effectively in AWS, it's crucial to avoid using the root user account for regular operations due to its broad permissions. Instead, creating IAM Users with specific permissions is recommended. IAM (Identity and Access Management) in AWS involves Users, Roles, Groups, and Policies:

- **Users:** Individuals within your organization who need access to AWS resources.
- **Roles:** Used to delegate access to resources securely between AWS services.
- **Groups:** Collections of users. Policies are attached to groups to define permissions for multiple users at once.
- **Policies:** Documents defining permissions. For instance, the "Administrator Access" policy grants full AWS control.
<br>

To enhance security in AWS, **avoid using the root account for daily tasks**. Create **IAM users for individuals** needing access and group them based on roles, applying appropriate policies. This ensures controlled access and minimizes security risks associated with unrestricted account use. **Let's create an IAM user in AWS**

**Step 1 - Sign in to AWS Management Console:**
Here are the steps to follow:
- Go to the [AWS Management Console](https://aws.amazon.com/console/) and sign in with your root user credentials.
- Type **"IAM"** in the search bar and select the IAM service from the list.

**Step 2 - Access IAM Dashboard:**
- In the IAM dashboard, click on **"Groups"** in the left-hand menu.
- Click on the **"Create group"** button to begin creating a new IAM group.
- Enter a suitable name for the group, such as **"AdminGroup"** or any other descriptive name.
![Group](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edwrq9oaj562k4yqdl8f.png)

**Step 3 - Attach Policies:**
- In the **"Attach permissions policies"** step, search for and select policies such as **"AdministratorAccess"** and **"Billing"** from the AWS managed policies list. These policies provide permissions for administrative tasks and billing management.
- Review the policies that are attached to the group.
- Click on **"Create group"** to complete the creation of the IAM group.
![Policies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/61w4bfsi66duguh9d0aq.png)

**Step 4 - Add User:**
- Click on the **"Add user"** button to start creating a new IAM user.
- Enter a suitable name for the user, such as **"Admin"** or another descriptive name.
- **Choose the type of access for the user:**
  - **Programmatic access:** Allows interaction with AWS services via APIs, SDKs, and CLI.
  - **AWS Management Console access:** Enables sign-in to the AWS Management Console with a custom password. Ensure the option "User must create a new password at next sign-in" is selected.
- Add the user to the IAM group created earlier with defined permissions.
- Review the user details, permissions, and tags (if applicable).
- Click on **"Create user"** to complete the creation of the IAM user.

![user](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipvmyab1jq8wezwp4o3z.png)
![add group](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4iw4ytq3vzdqkutz7gs.png)

**Step 5 - Sign-in with IAM User:**
- If it's your first time logging in, you'll be prompted to set a new password. Ensure to choose a secure password.
- Access the AWS Management Console either with the provided console login link or by visiting the AWS Management Console homepage directly.
- Once logged in, you can manage AWS services based on the permissions assigned to your IAM user.

**Step 6 - Enable Multi-Factor Authentication (MFA):**
- Go to the AWS Management Console.
- Navigate to the IAM (Identity and Access Management) service.
- Select **"Users"** and then your username.
- Under the **"Security Credentials"** tab, click **"Activate MFA"** and follow the instructions to enable MFA using a virtual MFA device like Google Authenticator.

<br>
##**<center>Billing and Cost Management</center>**
![Cost](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efd6nzjnygzujcf91xm6.png)

**AWS Billing and Cost Management** offers tools and resources for monitoring, managing, and optimizing AWS spending and usage. It enables setting budgets, tracking costs, analyzing usage patterns, and accessing detailed billing reports to effectively manage AWS expenses.

Here is the documention on AWS [Billing](https://aws.amazon.com/aws-cost-management/aws-billing/) and [Cost Management.](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-what-is.html)

Let's **configure billing alarm** to ensure compliance with AWS Free Tier limits and **avoid incurring charges**. Below are the steps to achieve this:

**Step 1: Navigate to AWS Billing Dashboard**
Sign in to the AWS Management Console, then navigate to the **"Billing and Cost Management"** dashboard under your user account.
![Billing Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ywek5xmhwxo68lq6fkc8.png)

**Step 2: Access Billing Alarms**
In the left-hand menu, go to the **"Preferences and Settings"** section and click on **"Billing Preferences."** Next, enable **"Invoice delivery preferences"** and **"Alert preferences"** by entering your email ID, and ensure all three options are selected to receive alerts via email.
![Alarm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udit7bpwgecspyazx4ob.png)

**Step 3: Setup CloudWatch Alram**
Now under services, locate the CloudWatch service (which is a monitoring service). Ensure you are in the **"N. Virginia"** region to create a billing alarm and monitor your bills effectively.
![CloudWatch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09jfjgga6cjn4j0s0luk.png)
In the left-hand menu, navigate to the **"Alarms"** section and click on **"All Alarms"** to view existing alarms or **"Create Alarm"** to set up a new one.
![Alarm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wg1qzvli69xxj5y709uy.png)
Now click on **"Select Metric"**, choose **"Billing"** as the service, then select **"Total Estimated Charge"**, ensure the currency is set to **"USD"**, and click **"Select Metric"** to proceed.
![Metric](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4aweqgyruz29ijigo7x.png)

**Step 4: Define Alarm Threshold**
Set the alarm threshold just below the Free Tier usage limits to receive alerts before incurring charges. For example, set the alarm when estimated charges exceed **$5** if applicable.
![Threshold](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c5grby43gjq4m68ntrmh.png)

**Step 5: Configure Notification**
Create an SNS topic to receive notifications when the alarm threshold is reached, then click **"Next"** to proceed.
![SNS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orr009gi9999h051p14u.png)

**Step 6: Confirm and Create**
Give the alarm a name, then click **"Next"** to review your settings. Finally, click **"Create Alarm"** to activate the billing alarm.
![Confirm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytdj1cgpf2k37qf5cjn9.png)
You will receive an email to confirm your subscription and start receiving alerts.
![Subs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lddgzthrjys42sc3qfbb.png)
![Done](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3e4wbzwygbp5nb3pue1e.png)

**Regularly monitor your AWS usage and configure billing alerts to notify you when your usage nears or exceeds the free tier limits. Ensure responsible and secure account management at all times!**