AWS IAM

AWS IAM

DevOps AWS IAM 1

Untitled%2045.png

Untitled%2046.png

  • resources: the entities you create in AWS eg. S3 bucket or EC2
  • Policy Statement
    1. Sid: name of this policy statement
    2. actions: perform actions on resources. eg. createBucket. type of access that is allowed or denied accesss
    3. implicit deny: 没声明的不行,deny 不行;同时给了 allow 和 deny,按照 deny 处理(aws 会先处理 deny 清单,pass 后处理 access 清单,都没有?deny)
    4. resource: limit the scope of this action. 对哪个 resource 执行的这个 action
    5. principal: 站在 resource 角度,决定谁可以使用本 resource。不太常见的原因是我们 attach policies to principles,这个 principle 要么是 role,要么是 user。definiation: the entity that is allowed or denied access. (就是我这个 policy 是针对谁的)
    6. condition: constraints that you can apply to your policy docs depending on context
  • Policy 被赋予给一个用户时,该用户可以根据这个 policy 进行 UI web,CLI 和 SDK 的对资源进行操作
  • Amazon Resource Name(ARN):唯一指定 AWS 资源, 部分可省略,用::代替 eg. arn:partition:service:region:account-id:resource-type:resource-id
  • trust relationships: account1 trust account2, and account2 trust account2, so account can consume role from each other
  • Least privileged model 够用就行原则

IAM policies:

  1. Who should have access to do what?
  2. AWS Evaluation: can this person call this action on this resource

when you define access policies. You specify which IAM principals are allowed to perform which actions on specific AWS resources and under which conditions

DevOps AWS IAM 2

1411662087834_.pic.jpg

  • Policy 分为 identity-based policy 和 resource-based policy
    1. 这两个是完全相互独立的,resource-based resource 相当于站在 resource 视角,看本 resource 可以被哪些资源所访问,且无法做到批量赋予,每个 resource 的 policy 都是根据情况单独赋予的(principal),跨 resource 间无法重复使用。
    2. identity-based policy 是站在 user, group 与 role 视角,可以被多次重复访问 和 批量赋予的
  • roles: 非登录账号(不是 Group/User)的其他东西来使用 aws 的 service,将 AWS service 连接到 IAM 服务中。当我有一个 EC2 instance 时,会创建一个 role,使其可以去连接到 S3
  • 每一个 policy 有多个 statements,但每个 statement 只有一个 policy
  • resource-based-policy 主要去各个服务界面去设定,即服务之间的权限,让服务和对应的 resource 能够有权限进行通信
  • role 和 resource-based policy 都可以让 resource 和 resource 之间进行通信 (前提是 role 中塞了相关的 resource-based policy)
;