aws + sso · 2019. 11. 27. · on subset of api events aws resources aws ec2 run- -- key-name...

17
AWS + SSO overcoming challenges

Upload: others

Post on 20-Jan-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

AWS + SSOovercoming challenges

Page 2: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

AWS CLI w/ Roles

Page 3: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

MotivationAn SSO user (SUNet ID) inherits permissions via a an AWS Role through their membership to a Stanford Workgroup.

Page 4: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

Good news: instead of administering an account and/or IAM for each faculty member and/or RA, we just administer a single level of permission. Plus, we get all the extra security associated with leveraging SUNet (MFA, id expiration).

Motivation

Page 5: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

MotivationBad news: These Roles do not have keys associated with them making aws cli use impossible without some backend engineering

Page 6: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

SolutionProgrammatically create a temporary IAM role by following the instructions here:

https://aws.amazon.com/blogs/security/how-to-implement-a-general-solution-for-federated-apicli-access-using-saml-2-0/

Our code:

https://code.stanford.edu/morrowwr/awscli-console

Page 7: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 8: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

Auto-Tagging EC2

Page 9: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

Motivation

As is, if an SSO user were to spin up an EC2 instance, the cost associated

with that instance would be difficult to parse out of total costs across all instances in the account.

However, tagging resources (EC2 instances) by unique identifier of the creator for allows for improved cost allocation purposes

Page 10: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 11: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 12: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

... granting users the permissions to manually assign tags

does not solve the problem

1. users may fail to tag

2. users may tag incorrectly

Page 13: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa

SolutionProgrammatically tag EC2 Resources

AWS Lambda+S3+Cloudtrail application via AWS CloudFormation template

https://github.com/GorillaStack/auto-tag

Page 14: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 15: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 16: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa
Page 17: AWS + SSO · 2019. 11. 27. · on subset of API events AWS Resources aws ec2 run- -- key-name -associate- instances --image-id MyKeyPair - -security- public-ip- address ami-c3b8d6aa