Guest User

Untitled

a guest
Oct 10th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. ### First log in to AWS using your default credentials:
  2.  
  3. ```bash
  4. $ aws_adfs_auth
  5. Username: <ntid>
  6. Password: <password>
  7.  
  8. <<ROLE SELECTION>>
  9. ```
  10.  
  11. ### Update your AWS credentials file and add a new profile
  12.  
  13. In this example we want to test the capabilites of an AMS service so we'll create a new block in `~/.aws/credentials` that looks like:
  14.  
  15. ```
  16. [ams_service]
  17. role_arn = arn:aws:iam::794055897284:role/LambdaCreated/ECSTaskRun
  18. source_profile = saml
  19. ```
  20.  
  21. ##### Set your AWS_PROFILE to ams_service:
  22.  
  23. ```bash
  24. $ export AWS_PROFILE=ams_service
  25. ```
  26.  
  27. ##### Verify that you have assumed the role:
  28.  
  29. ```bash
  30. aws sts get-caller-identity
  31. ```
  32.  
  33.  
  34. ### Testing Pulls from another repository
  35.  
  36. We want to pull an image from `756134506823.dkr.ecr.us-east-1.amazonaws.com/xh-cloud/alpine-oracle-java:8-server-jre-181b13` (in test01) using a role from int01. The ECR repository should have a policy that looks like:
  37.  
  38. ```
  39. {
  40. "Version": "2008-10-17",
  41. "Statement": [
  42. {
  43. "Sid": "pod_access",
  44. "Effect": "Allow",
  45. "Principal": {
  46. "AWS": [
  47. "arn:aws:iam::899712721709:root",
  48. "arn:aws:iam::794055897284:root"
  49. ]
  50. },
  51. "Action": [
  52. "ecr:ListImages",
  53. "ecr:DescribeRepositories",
  54. "ecr:DescribeImages",
  55. "ecr:GetRepositoryPolicy",
  56. "ecr:GetLifecyclePolicy",
  57. "ecr:GetLifecyclePolicyPreview",
  58. "ecr:GetDownloadUrlForLayer",
  59. "ecr:BatchGetImage",
  60. "ecr:BatchCheckLayerAvailability"
  61. ]
  62. }
  63. ]
  64. }
  65. ```
  66.  
  67. ```bash
  68. $(aws ecr get-login --registry-ids 756134506823 --no-include-email --region us-east-1)
  69. ```
  70.  
  71. and test a pull:
  72.  
  73. ```bash
  74. docker pull 756134506823.dkr.ecr.us-east-1.amazonaws.com/xh-cloud/alpine-oracle-java:8-server-jre-181b13
  75. ```
Add Comment
Please, Sign In to add comment