When you create an AWS account, what you’re creating is a root account: the main account, which can do basically everything. If someone gets your credentials, it isn’t only a security problem, it’s a money problem. A well-known move by these groups is to get into the account and spin up lots of EC2 instances to mine Bitcoin, and the bill lands on you. In this post I explain how to secure your account in a few minutes, how to notice if something odd is going on, and what to do if it already happened, which is exactly what I went through.
Note: the video is in Spanish (Spanish audio only).
The root account is only for critical tasks
The root account should only be used for billing or critical security matters. For day-to-day work you create users with just the permissions they need (I explain it in the IAM permissions video). So the first thing is to protect root.
Turn on MFA for the root account
MFA (multi-factor authentication, or 2FA) means your username and password aren’t enough to sign in: you also need a code that only you have, on your phone.
- In the AWS console, search for the IAM service. That’s where all the options for accounts, users and security keys are.
- Since the account is new, AWS shows you the prompt to add MFA. Click Assign MFA.
- Name your device and choose Authenticator app as the type. I use Google Authenticator, which you can download from the App Store or Play Store.
- Scan the QR code with the app. You’ll see a six-digit code.
- AWS asks for two codes in a row to confirm it’s set up correctly: type the one you see now in the first field, wait for the app to show a new one, and type it in the second.
- Click Next. Your MFA device now appears in the list.
To confirm it works, sign out and sign back in: the console now asks for the code from the app. From now on, even if someone has your username and password, they can’t get in without your phone.
How to notice something is wrong
Securing the account is half the job. The other half is finding out quickly if someone is using it:
- Create a budget with alerts. If billing changes unexpectedly, you get notified. I go through it step by step in the AWS budgets video.
- Set up CloudWatch alerts that tell you when new instances are created.
- Set up alerts for when the root credentials are used. If root is only for critical tasks, any use you didn’t make is a warning sign.
What to do if your account was already compromised
- Change your account’s sign-in details.
- Check billing and look for the services generating unexpected costs.
- Turn those services off.
- Open a case with AWS Support and tell them everything that happened.
They’ll remind you of the shared responsibility model: controlling who gets into your cloud is your responsibility. Even so, it’s well worth writing to them.
What happened to me with S3
One day, S3 started logging an absurd number of requests: it was costing me about $50 a day, on an online store that didn’t get that much traffic. Before contacting support I had already deleted every access key related to that bucket, and the requests kept coming anyway.
Support told me my credentials had probably leaked and that, to see what was going on, it was up to me to set up CloudTrail and CloudWatch. I wasn’t so sure, because I was the only one handling the keys. Two weeks later, AWS published an announcement changing S3’s pricing model: until then, every request to a bucket was charged even when it wasn’t authenticated. Most likely someone found my bucket’s name and started sending it requests, around 30 million a day.
Even though they told me the problem was on my side, support was very professional: the debt was about $300 and they gave me credits for roughly double that, to pay it off and keep experimenting. So if something happens to your account, write to them: they can help a lot.
Summary
Turn on MFA for root, use it only for critical tasks, create a budget with alerts, and know what to do if something goes wrong. It takes a few minutes, and the money at stake is yours, whether the project is small or big.
Found it useful? Watch the full video on YouTube (in Spanish) and subscribe to @Andrevops for more videos like this one.




