If you are dealing everyday with dozens of users in AWS and you like to have (or believe that you have) control over them; that you like to believe that you drive them like a good flock of sheep, you will feel my pain, and I’ll feel yours.
We manage multiple AWS accounts, for many purposes. Some accounts with more restrictions than others, we kinda control and deny to use some regions, some instance types, some services, etc. Just for security and budget control (like you do as well, probably).
That being said, you are now a “ninja” of AWS IAM because you have to add, remove, create, change, test and simulate easy and complex policies pretty much everyday, to make your flock trustfully follow its shepherd.
But dealing with users is great to test the strength of your policies. I have a policy where explicitly denied a list of instance types to be used (a black list with “ec2:RunInstances”). Ok, it denies to create them, but not to stop them, change instance type and start them again. You may end up feeling that your control is like this:
# create an allowed instance aws ec2 run-instances --image-id ami-c58c1dd3 \ --count 1 --instance-type t2.large --key-name sec-poc \ --security-group-ids sg-12b5376a --subnet-id subnet-11fe4e49 \ --profile soleng --region us-east-1 # check status aws ec2 describe-instances --instance-ids i-0152bc219d24c5f25 \ --query 'Reservations[*].Instances[*].[InstanceType,State]' \ --profile soleng --region us-east-1 # stop instance aws ec2 stop-instances --instance-ids i-0152bc219d24c5f25 \ --profile soleng --region us-east-1 # check status aws ec2 describe-instances --instance-ids i-0152bc219d24c5f25 \ --query 'Reservations[*].Instances[*].[InstanceType,State]' \ --profile soleng --region us-east-1 # change instance type aws ec2 modify-instance-attribute --instance-id i-0152bc219d24c5f25 \ --instance-type "{\"Value\": \"i2.2xlarge\"}" \ --profile soleng --region us-east-1 # start instance type aws ec2 start-instances --instance-ids i-0152bc219d24c5f25 \ --profile soleng --region us-east-1 # check status aws ec2 describe-instances --instance-ids i-0152bc219d24c5f25 \ --query 'Reservations[*].Instances[*].[InstanceType,State]' \ --profile soleng --region us-east-1 # terminate instance aws ec2 terminate-instances --instance-ids i-0152bc219d24c5f25 \ --profile soleng --region us-east-1
One thought to “Bypassing AWS IAM: How important it is to look closely at your policies”