![](https://velog.velcdn.com/images/chaeri93/post/5c25f966-24d9-4ffb-875e-616be938a16b/image.png)
IAM이란 무엇인가?
IAM의 풀 명칭은 Identity and Access Management으로 AWS 리소스를 안전하게 제어할 수 있도록 AWS 계정과 리소스의 권한을 관리하는 AWS의 글로벌서비스이다. IAM을 사용하여 리소스를 사용하도록 인증(로그인) 및 권한 부여(권한 있음)된 대상을 제어해준다.
- 루트계정은 디폴트값으로 생성되며 보안에 취약하기 때문에 사용되거나 공유되면 안된다
- User(사용자): 자신의 organization에 포함되어 있는 사람(계정)
- Groups: 여러개의 user 포함
- user는 group에 속하지 않아도 되며 반대로 여러개의 그룹에 포함되어도 된다
![](https://velog.velcdn.com/images/chaeri93/post/76121b80-5663-44ce-93e3-69e74215996f/image.png)
IAM Roles
일부 aws 서비스는 나를 대신하여 작업을 수행해야 하는데 이를 위해 aws role을 사용하여 aws 서비스에 권한을 할당할 것이다. 이 Role은 다양한 엔티티에 부여할 수 있어 user와 굉장히 비슷한 개념이다.
사용예시
- EC2 Instacne Roles
- Lambda Function Roles
- Roles for CloudFormation
![](https://velog.velcdn.com/images/chaeri93/post/cd85a990-2495-4ff2-aad6-d14a1cc4cb63/image.png)
IAM Role vs User
한마디로 사람이고 영구적이라면 user를 사람이 아니거나 사람이지만 일시적인작업을 할때 role을 사용하면 된다.
![](https://velog.velcdn.com/images/chaeri93/post/09165a14-403c-4e5d-8cf9-96e52318c04f/image.png)
IAM: Permissions
User 또는 Groups에 Policies이라는 JSON document를 할당할 수 있다. AWS에서는 사용자가 필요로 하는 최소한의 권한만을 허용한다.
![](https://velog.velcdn.com/images/chaeri93/post/c2e146ef-110c-48f1-adc1-027823fd8fcd/image.png)
전체 구성
- Version: policy language version
- ID: identifier for the policy(선택)
- Statement: one or more individual statements(필수)
Statements 구성
- Sid: identifier for the statement(선택)
- Effect: whether the statement allows or denies access
- Principal: account/user/role to which this policy applied to
- Condition: conditions for when this policiy is in effect(선택)
IAM Policy Statement Priority (우선순위)
- 명시적 거부: 요청에 대한 모든 정책에서 Deny 를 발견하면 거부
- 명시적 허용: 요청에 대한 모든 정책에서 Allow를 발견하면 허용 (요청에 대한 모든 정책에 Deny가 없으면)
- 묵시적 거부(Implicit Deny) : 요청에 대한 모든 정책에서 Allow를 발견하면 허용
Multi Factor Authentication (MFA)
루트 사용자와 IAM 사용자를 보호하기 위한 다중인증 기능이다. 비밀번호를 해킹당해도 계정이 보호될수 있다.
MFA = Password you know + security device you own
![](https://velog.velcdn.com/images/chaeri93/post/3857f372-f599-46af-9e5d-d1ed1b06ce30/image.png)
보안 장치
▪ 가상 MFA 기기 (Google Authenticator, Authy)
▪ Universal 2nd Factor 보안키
▪ 하드웨어 Key Fob MFA 장치
▪ 하드웨어 Fob MFA 장치 for AWS GovCloud (US)
IAM 요약
- Users: 물리적 사용자와 연결되어 AWS Console에 비밀번호를 가지고 있다
- Groups: user만 포함하고 있다
- Policies: 사용자 및 그룹에 대한 권한을 설명해주는 JSON 문서
- Roles: EC2 Instance와 같은 AWS Service에 권한 부여
- Security: MFA + Password Policy