Enhancing AWS Security: Implementing Root Account Login Alerts
When it comes to cloud computing, security is a big deal. Luckily, Amazon Web Services (AWS) has got your back with some awesome tools and services to help keep your infrastructure safe. But it’s still up to you to monitor and protect your AWS accounts. One of the most important things you need to take care of is controlling access to your account’s Root user.
In this article, I’m going to walk you through a step-by-step guide on how to configure AWS services to send you alerts whenever someone logs in with your Root user. By following these instructions, you can beef up your AWS security.
Account Root User
The root user is the account’s primary user with full administrative privileges, similar to the root user in Linux systems.
Root user credentials are the email address and password used during account creation. The root user has full control over the account and a user cannot limit most of the permissions associated with the root user. For that reason, we don’t always use the root user.
The Root user is like the master key to your AWS kingdom. It has full access to everything in your AWS environment, which means it’s a prime target for bad actors.
Now what do we do instead?
Leverage the I AM (Identity and Access Management) to create users for our daily
tasks and activities.
Admin User: Use IAM to create a user with administrative privileges for daily
administrative tasks instead of using the root user.
Other Users: Utilize IAM to generate individual users responsible for daily tasks.
Each IAM user can be assigned specific permissions, ensuring they only
have access to the resources they need.
Step 1: Create a CloudTrail with CloudWatch login enabled.
Let’s Create a Trail in the CloudTrail console.
In the search box, type CloudTrail, then select CloudTrail. On the left side of CloudTrail UI, select trails, then click Create Trail.
Fill in the required details under the general information.
Under the CloudWatch Logs, enable the CloudWatch logs by ticking the check box. Fill in the required details.
Click Next and keep the things as default on the next page.
Click Next Review and Click Create trail.
The Trail is created. Copy the log group name for later use.
Step 2: Create an SNS topic and create a subscription on it
Now, jump to the SNS service.
Under the Topics, click Create Topic.
Fill in the details as shown below.
Keep the remaining as default and click Create topic. At the bottom, Under the subscription, click Create subscription.
Provide the required details, for protocol, select the drop-down button and select email, endpoint key in your email account then Click Create subscription.
You will receive an email at the mentioned email address to confirm the subscription. Make sure you confirm your subscription.
Step 3: Create a Metric filter on the CloudWatch
Now, jump to the CloudWatch. Click on the Log Groups and search for the log group name you have copied in the previous step.
Click the log group name. Click on the Metric filters. Click Create metric filter.
In the Filter pattern, put the following pattern:
{ $.userIdentity.type = “Root” && $.userIdentity.invokedBy NOT EXISTS && $.eventType != “AwsServiceEvent” }
Click Next
Provide a Filter name. Fill in the Metric details.
Click Next and Click Create metric filter.
You can find the created metric filter.
Step 4: Create a CloudWatch Alarm.
Tick the check box at the upper right corner of the metric and click Create alarm.
You will be redirected to the CloudWatch alarm dashboard.
Change the Condition to Greater/Equal and define the threshold value as 1. Click Next.
Under the Configure actions, select the SNS topic you have created in the previous step. Click Next.
Provide a name to the alarm. Click Next.
Review and click Create alarm.
That’s it! The alarm is created and the condition is ok.
Let’s use this command to set the condition of the alarm to in-alarm
Our alarm has gone to alarm state and checking our email account, we can find an email notification.
Conclusion:
Setting up alerts for Root account logins adds an important layer of security to your AWS environment. This allows you to respond quickly to potential threats.
With these alerts in place, you can rest assured that you have an additional layer of protection safeguarding your AWS environment Monitoring Root account activity not only helps prevent unauthorized access but also promotes best practices by encouraging the use of IAM users for everyday operations.
If you have any questions concerning this article or have an AWS project that requires our assistance, please reach out to us by leaving a comment below or email us at [email protected].
Thank you!
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.