AngzavA
[AWS CDA] #4 IAM & AWS CLI 본문
IAM : Identity and Access Management - 사용자를 생성하고 그룹에 배치하는 글로벌 서비
- 루트 계정 = 아이디 생성 했을 때 만들어짐 > 사용자를 만들어야 함, 그룹으로도 생성 가능
- 조직의 사람들은 그룹화 가능, 그룹은 user만 포함하고, 다른 그룹을 포함하지 않음
- 개인은 여러개의 그룹에 포함될 수 있음
>> 그룹 생성 이유 = AWS 계정을 사용하도록 허용하기 위함
IAM : Permissions
Users or Groups can be assigned JSON documents called policies
모든 사용자에게 모든 권한은 AWS에서 허가하지 않음, 비용/보안 문제 야기 >> 최소 권한의 원칙 적용
사용자가 세 개의 서비스에 접근하게 된다면 그에 대한 권한만 생성
IAM 생성 후 그룹 지정 및 aws url 로 시크릿창에서 연결
AWS 로그인 = 루트 계정 / IAM 계정
[IAM Policies inheritance]
Structure
- Consists of
- Version : policy language version, always include "2012-10-17"
- Id : an identifier for the policy (optional)
- Statement : one or more individual statements (required) - Statements consists of
- Sid : an identifier for the statement (optional)
- Effect : whether the statement allows or denies access (Allow, Deny) - 특정 API에 접근하는 걸 허용할지 거부할지
- Principal : account/user/role to which this policy applied to - 특정 정책이 적용될 사용자, 계정, 혹은 역할
- Action : list of actions this policy allows or denies - effect에 기반하여 허용 및 거부되는 API 호출 목록
- Resource : list of resources to which the actions applied to - 적용될 action의 리소스 목록으로
- Condition : conditions for when this policy is in effect (optional)
AdministratorAccess
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
직접 권한 생성
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:ListUsers",
"iam:GetUser"
],
"Resource": "*"
}
]
}
IAM 보안 정책
- IAM - Password Policy : 더 높은 보안성, 비밀번호 최소길이, 특정 유형 문자 사용 등 요구 가능, 비밀번호 변경 허용이나 금지 시키기 가능, 기간마다 비밀번호 변경 유도, 이전에 사용한 비밀번호 재사용 금지 등
- Multi Factor Authentication - MFA(다요소 인증) : 루트 계정과 전체 IAM 사용자 보호 = MFA
MFA = 가지고 있는 보안 장치 활용(토큰) + 비밀번호
** Main benefit of MFA, if a password is stolen or hacked, the account is not compromised
MFA devices options in AWS
- Virtual MFA devices
- Google Authenticator(phone only)
- Authy(multi-device)
: support for multiple tokens on a single device - Universal 2nd Factor(U2F) Security Key
- Yubikey by Yubico - Hardware Key Fob MFA Device
: Provided by Gemalto - Hardware Key Fob MFA Device for AWS GovCloud(US)
: Provided by SurePassID
AWS access 방식 3가지
- AWS Management Console(protected by password + MFA)
- AWS Command Line Interface(CLI) : protected by access keys
- AWS Software Developer Kit(SDK) - for code : protected by access keys
access key = generated through the AWS Console
Access Key ID ~= username
Secret Access Key ~= password
AWS CLI
A tool that enables you to interact with AWS services using commands in your command-line shell
Direct access to the public APIs of AWS services - alternative to Console
AWA SDK = AWS Software Development Kit
특정 언어 라이브러리 집합, 프로그래밍 언어에 따라 개별 SDK 존재
터미널 내 사용 X, 코딩을 통해 앱 내 심어 두는 것
aws configure
AWS Access Key ID :
AWS Secret Access Key :
Default region name :
aws iam list-users > 모든 사용자 나열
AWS CloudShell
AWS site 내부에 있음, 모든 리전이 가능한 것은 아님
echo "test" > demo.txt
ls 에 쌓임
pwd 해서 파일 다운로드 할 수 있음
IAM의 역할
- EC2 Instance Roles
- Lambda Function Roles
- Roles for CloudFormation
AWS 서비스 역할을 직접 만들 수 있음 = EC2 인스턴스나 람다 함수에서 가장 많이 사용
IAM Security Tools
- IAM Credentials Report (account-level) : 자격 증명 보고서 제작 가능
- Credential report - Download Report - CSV 파일 다운로드 - IAM Access Advisor(user-level) : 서비스의 권한과 마지막 액세스 시간 열람 가능
IAM Guidelines
- 루트 계정은 AWS 계정 설정 제외 사용 금지
- One physical user = One AWS user
- 자격 증명을 주지 말고 새로운 사용자를 만들고, 그룹에 넣어 그룹 권한을 줘라
- MFA 사용을 강화
- AWS 서비스에 권한 부여마다 역할을 만들어 사용
- CLI나 SDK에 액세스 키 필수
- IAM 사용자와 액세스 키 공유하지 말기
Users : mapped to a physical user, has a password for AWS Console
Groups : contains users only
Policies : JSON document that outlines permissions for users or groups
Roles : for EC2 instances or AWS services
Security : MFA + Password Policy
Access Keys : access AWS using the CLI or SDK
Audit : IAM Credential Reports & IAM Access Advisor
- IAM 역할 : AWS 서비스에서 사용할 AWS 서비스 요청을 위한 권한 집합을 정의하는 IAM 엔티티
- IAM 보안 도구 = IAM 자격 증명 보고서
- IAM 사용자는 자신의 자격 증명(사용자 이름 및 암호 또는 액세스 키)을 사용하여 AWS 서비스에 액세스함
- 루트 사용자 계정을 사용하지 않는다
- IAM 정책 = AWS 서비스에 요청을 보내는 권한의 집합을 정의하고 IAM 사용자, 사용자 그룹 및 IAM 역할이 사용할 수 있는 JSON 문서
- IAM 권한, 최소 권한 부여 원칙
- 루트 계정 보안 = MFA 활성화
- IAM 사용자 그룹은 다른 사용자 그룹에 속할 수 없음
- IAM 정책의 문 = Sid, Effect, Principal, Action, Resource, Condition
- AWS Shared Responsibility Model 중 AWS 책임 = AWS 인프라
'AWS' 카테고리의 다른 글
[AWS CDA] #5 EC2 (0) | 2023.07.28 |
---|---|
[AWS CDA] #3 AWS 시작 (0) | 2023.07.27 |