AWS Security 
Jason Chan 
chan@netflix.com : @chanjbs 
SAINTCON 2014
Quick Survey 
AWS Experience 
1-4
14m users in 1+ year
14m users in 1+ year 
150m photos
14m users in 1+ year 
150m photos 
3 engineers
14m users in 1+ year 
150m photos 
3 engineers 
$1B acquisition by FB
So . . .
idea + cloud = profit!
So . . .
Goal: AWS benefits, securely
AWS Intro 
Typical Setup 
Thinking about AWS Security 
Tips and Traps 
Other Resources
Me 
Now: Security @ Netflix 
Before: Security @ VMware 
Before: @stake, iSEC
AWS
IaaS 
Undifferentiated heavy lifting
API-driven building 
blocks 
Customer control
Evolving quickly
Typical AWS Setup
Thinking About AWS 
Security
Philosophy
A note on security 
automation
Typically, how do 
you:
Create a user account
Create a user account 
Inventory your systems
Create a user account 
Inventory your systems 
Update a firewall config
Create a user account 
Inventory your systems 
Update a firewall config 
Make a forensic image
Create a user account 
Inventory your systems 
Update a firewall config 
Make a forensic image 
Disable a MFA token
In AWS . . .
CreateUser() 
DescribeInstances() 
AuthorizeSecurityGroupIngress() 
CreateSnapshot() 
DeactivateMFADevice()
Three Areas of Focus
Shared Responsibility
Guidance 
High-level 
• CSA and ENISA guidance 
AWS specific 
• Security Whitepaper 
• Risk and Compliance Whitepaper 
• Security Center and Compliance Center
Shared responsibility tips 
Understand the model, and what AWS can't do 
Engage AWS for support - SSAE 16, PCI, etc.
Shared responsibility traps 
AWS can help, but you're ultimately responsible 
Contract, Ts & Cs are not a firewall
Segregation and 
Access Control
"Users/Accounts" in 
AWS
Users = API access control 
Three types 
1. Main/Root 
2. IAM 
3. IAM Roles for EC2
IAM user 
(accounts for humans)
Keys are static 
Must be protected
IAM role 
(accounts for 
services)
Keys are short-lived 
Difficult to protect
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access 
{ 
"Code" : "Success", 
"LastUpdated" : "2012-04-26T16:39:16Z", 
"Type" : "AWS-HMAC", 
"AccessKeyId" : "AKIAIOSFODNN7EXAMPLE", 
"SecretAccessKey" : "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", 
"Token" : "token", 
"Expiration" : "2012-04-27T22:39:16Z" 
}
Users in AWS - Tips 
Don't use the root account 
Protect IAM keys 
Use IAM roles for EC2
Users in AWS - Traps 
Keys have a way of finding 
themselves in GitHub 
No way to control access to EC2 
metadata
Permissions and 
Policies
Suggested homework 
Read the API docs
Two Permission Types 
1. User-Based - Attached to a user, controls what the user can 
do (also applies to groups and roles) 
2. Resource-Based - Attached to a resource, controls what can 
be done to the resource
Bonus, Confusing Third Type 
• Resource-Level - Attached to a user, controls what the user 
can do, to which resource
User policies
{ 
"Statement": [ 
{ 
"Action": [ 
"ses:SendEmail" 
], 
"Effect": "Allow", 
"Resource": "*", 
"Condition": { 
"IpAddress": { 
"aws:SourceIp": "1.1.1.1" 
} 
} 
} 
] 
}
Common approach - 
blacklisting
{ 
"Statement": [ 
{ 
"Effect": "Allow", 
"Action": "*", 
"Resource": "*" 
} 
] 
} 
{ 
"Statement": [ 
{ 
"Action": "ses:*", 
"Effect": "Deny", 
"Resource": "*" 
}, 
{ 
"Action": "iam:*", 
"Effect": "Deny", 
"Resource": "*" 
} 
] 
}
Creating policies 
• AWS has dozens of services 
• Hundreds of API calls across those services 
• Resource-level control and conditions provides tremendous 
granularity
Sounds great! 
Sign me up!
Looking at resource-level 
policies again
Who (or what) can 
apply (or delete) 
tags?
Permissions and policies - Tips 
Think least-privilege 
Think traditional RBAC
Permissions and policies - Traps 
Be careful with tag-based security 
Be careful with policy size limitations 
Be careful with non-specific policies
Account-Level 
Strongest separation
Account segregation - Tips 
Test / Dev / Staging / Prod 
Compliance requirements 
Business units (billing boundaries) 
Core/platform vs. end-user
Account segregation - Traps 
Cross-account limitations (VPC security groups, S3) 
Logistics and planning - AZ mapping, reservations and 
limits
Monitoring AWS 
Security
Bill as IDS 
AWS Billing Alerts
CloudTrail 
Logging of API calls
{ 
"Records": [{ 
"eventVersion": "1.0", 
"userIdentity": { 
"type": "IAMUser", 
"principalId": "EX_PRINCIPAL_ID", 
"arn": "arn:aws:iam::123456789012:user/Alice", 
"accessKeyId": "EXAMPLE_KEY_ID", 
"accountId": "123456789012", 
"userName": "Alice" 
}, 
"eventTime": "2014-03-06T21:22:54Z", 
"eventSource": "ec2.amazonaws.com", 
"eventName": "StartInstances", 
"awsRegion": "us-west-2", 
"sourceIPAddress": "205.251.233.176", 
"userAgent": "ec2-api-tools 1.6.12.2", 
"requestParameters": { 
"instancesSet": { 
"items": [{ 
"instanceId": "i-ebeaf9e2" 
}] 
} 
},
"responseElements": { 
"instancesSet": { 
"items": [{ 
"instanceId": "i-ebeaf9e2", 
"currentState": { 
"code": 0, 
"name": "pending" 
}, 
"previousState": { 
"code": 80, 
"name": "stopped" 
} 
}] 
} 
} 
}, 
... additional entries ... 
] 
}
Trusted Advisor 
Checks config vs. best practices
Shameless Plug 
Section of the Talk
Edda 
AWS config history
What instance has a given public 
IP? 
$ curl "http://edda/api/v2/view/instances;publicIpAddress=1.2.3.4;_since=0"
$ curl "http://edda/api/v2/view/instances;publicIpAddress=1.2.3.4;_since=0" 
["i-0123456789","i-012345678a","i-012345678b"]
What is the most recent change to 
a security group? 
$ curl "http://edda/api/v2/aws/securityGroups/sg-0123456789;_diff;_all;_limit=2"
$ curl "http://edda/api/v2/aws/securityGroups/sg-0123456789;_diff;_all;_limit=2" 
--- /api/v2/aws.securityGroups/sg-0123456789;_pp;_at=1351040779810 
+++ /api/v2/aws.securityGroups/sg-0123456789;_pp;_at=1351044093504 
@@ -1,33 +1,33 @@ 
{ 
"class" : "com.amazonaws.services.ec2.model.SecurityGroup", 
"description" : "App1", 
"groupId" : "sg-0123456789", 
"groupName" : "app1-frontend", 
"ipPermissions" : [ 
{ 
"class" : "com.amazonaws.services.ec2.model.IpPermission", 
"fromPort" : 80, 
"ipProtocol" : "tcp", 
"ipRanges" : [ 
"10.10.1.1/32", 
"10.10.1.2/32", 
+ "10.10.1.3/32", 
- "10.10.1.4/32" 
], 
"toPort" : 80, 
"userIdGroupPairs" : [ ] 
} 
], 
"ipPermissionsEgress" : [ ], 
"ownerId" : "2345678912345", 
"tags" : [ ], 
"vpcId" : null 
}
Security Monkey
Monitoring - Tips 
Know your options 
Ideal place to drive automation
Monitoring - Traps 
There is no configuration history 
CloudTrail logs are complex
AWS Security 
Resources 
http://tiny.cc/awssecurity
Thank you! 
chan@netflix.com : @chanjbs

Amazon Web Services Security