AWS Multi-factor authentication with Google Authenticator

Running infrastructure in the cloud means, you are allowing everybody to sniff your core as long as you are not implementing enough security measure. Now a days it is very easy to look into/modify your hosted service from any corner of the world – like someone from my small village in Bangladesh may sniff your cloud datacentre hosted in Sydney with his Chinese smartphone having a 2G network. What if your root account details has been compromised, it will be a disaster for you.

To tighten the security in AWS cloud there are few security measures you can follow:

  • Do not store your access key in AMI, instead use IAM role for allowing a machine to use a particular service
  • Periodically renew your access key
  • Enable multi-factor authentication for all users

Enabling multi-factor authentication for root user

  • After login to your AWS console, click on your user name and click security credential
  • Click Multi-Factor Authentication
  • Assuming that you have a smart mobile. I am using my android device to do that
  • Install Google Authenticator on your Android device
  • From your AWS console select A virtual MFA device
  • Click on Next step twice
  • Open the Google authenticator on your mobile
  • Scan QR Code with Google authenticator which is showing in your AWS console
  • After scanning the QR codes your mobile device will show you two authentication codes
  • Enter both code in Manage MFA device wizard
  • Click next step and click finish
  • Logoff from AWS console
  • Try to login again. The system will ask you for MFA token. Open google authenticator from your mobile device and enter that code and login