Servisphere
Biểu tượng AWS Identity and Access Management (AWS Architecture Icons)

AWS Identity and Access Management

Ai được làm gì

Quản lý danh tính (user, role) và chính sách (policy) quyết định ai được gọi API nào trên tài nguyên nào.

  • Chi phí$ Rẻ
  • Độ khó●●●●●
  • Để không có tốn tiền?Không
  • AWS quản lý
  • Có trong đềCLF · SAA · DVA · SOA

Phạm vi: Global

Mở IAM trên bản đồ →
Hình dungNhư hệ thống thẻ từ toà nhà: mỗi thẻ mở được những cửa nhất định.

IAM đứng ở đâu trong hệ thống?

Xem toàn bộ trên bản đồ →

Một ví dụ thật, từng bước

  1. Công ty mới mở tài khoản AWS; ai cũng đang dùng chung tài khoản root, rất nguy hiểm.
  2. Bạn bật MFA cho root, cất root đi, rồi tạo nhóm Developers chỉ có quyền với EC2, S3 và Lambda.
  3. Ứng dụng chạy trên EC2 cần đọc S3: bạn gắn IAM role cho máy thay vì ghi access key vào file cấu hình.
  4. AWS tự cấp khoá tạm thời cho role và đổi định kỳ, nên không có khoá cố định nào bị lộ trong code.
  5. Một policy có Deny xoá bucket production: kể cả có quyền khác cho phép, lệnh xoá vẫn bị chặn.

▶ Xem kịch bản “Ai bảo vệ cái gì” chạy trên bản đồ

Khi nào nên dùng

✓ Nên dùng khi

Luôn có: mọi lời gọi tới AWS đều qua IAM.

✗ Không nên dùng khi

Đăng nhập cho người dùng cuối của ứng dụng → Cognito.

Ví dụ hay gặp

  • Role cho EC2/Lambda/ECS gọi AWS API mà không cần access key
  • Phân quyền tối thiểu (least privilege) cho người và ứng dụng
  • Truy cập chéo tài khoản bằng AssumeRole

IAM, IAM Identity Center hay Cognito?

IAMIAM Identity CenterCognito
Dành choQuyền trong một tài khoản AWS (người, dịch vụ)Nhân viên đăng nhập một lần vào nhiều tài khoảnNgười dùng cuối của ứng dụng
Danh tínhUser, group, roleNgười dùng từ thư mục công tyUser pool, đăng nhập mạng xã hội
Thông tin đăng nhậpMật khẩu, access key, role tạm thờiQuyền tạm thời theo permission setToken JWT
PhíMiễn phíMiễn phíTheo số người dùng hoạt động

Tốn bao nhiêu tiền?

Ví dụ$0.
  • Cách tính: Miễn phí.
  • Miễn phí: Miễn phí.
⚠️ Bẫy chi phí

Không tốn tiền trực tiếp, nhưng quyền quá rộng có thể gây hoá đơn khổng lồ khi bị lộ khoá (bị dùng để đào coin). Dùng role thay cho access key dài hạn.

Giá tham khảo tại us-east-1, cập nhật ngày 14/10/2026, có thể đã thay đổi. Luôn kiểm tra lại trên bảng giá của AWS. Bảng giá chính thức của AWS ↗

💡 Mẹo thi

Dịch vụ AWS (EC2, Lambda) cần quyền → IAM role, không bao giờ để access key trong code. Deny rõ ràng luôn thắng Allow. Cho tài khoản khác truy cập → role cho phép assume chéo tài khoản. Đăng nhập người dùng app → Cognito, không phải IAM.

Thử sức với câu hỏi thi thật

Đề thi chứng chỉ AWS bằng tiếng Anh nên câu hỏi giữ nguyên tiếng Anh.

1A company is planning to run a group of Amazon EC2 instances that connect to an Amazon Aurora database. The company has built an AWS CloudFormation template to deploy the EC2 instances and the Aurora DB cluster. The company wants to allow the instances to authenticate to the database in a secure way. The company does not want to maintain static database credentials. Which solution meets these requirements with the LEAST operational effort?

  1. ACreate a database user with a user name and password. Add parameters for the database user name and password to the CloudFormation template. Pass the parameters to the EC2 instances when the instances are launched.
  2. BCreate a database user with a user name and password. Store the user name and password in AWS Systems Manager Parameter Store. Configure the EC2 instances to retrieve the database credentials from Parameter Store.
  3. CConfigure the DB cluster to use IAM database authentication. Create a database user to use with IAM authentication. Associate a role with the EC2 instances to allow applications on the instances to access the database.
  4. DConfigure the DB cluster to use IAM database authentication with an IAM user. Create a database user that has a name that matches the IAM user. Associate the IAM user with the EC2 instances to allow applications on the instances to access the database.
Xem đáp án

Đáp án đúng: C

Bật IAM database authentication cho Aurora và gắn IAM role cho EC2: ứng dụng lấy token tạm thời, không phải lưu mật khẩu cố định. Dùng IAM user gắn vào EC2 là sai; EC2 nhận quyền qua role.

2An administrator is using Amazon CloudFormation to deploy a three tier web application that consists of a web tier and application tier that will utilize Amazon DynamoDB for storage. When creating the CloudFormation template, which of the following would allow the application instance access to the DynamoDB tables without exposing API credentials?

  1. ACreate an Identity and Access Management Role that has the required permissions to read and write from the required DynamoDB table and associate the Role to the application instances by referencing an instance profile.
  2. BUse the Parameter section in the Cloud Formation template to have the user input Access and Secret Keys from an already created IAM user that has the permissions required to read and write from the required DynamoDB table.
  3. CCreate an Identity and Access Management Role that has the required permissions to read and write from the required DynamoDB table and reference the Role in the instance profile property of the application instance.
  4. DCreate an identity and Access Management user in the CloudFormation template that has permissions to read and write from the required DynamoDB table, use the GetAtt function to retrieve the Access and secret keys and pass them to the application instance through user-data.
Xem đáp án

Đáp án đúng: C

Tạo IAM role có quyền đọc ghi bảng DynamoDB và tham chiếu qua thuộc tính instance profile của instance trong template. Không đưa access key vào tham số hay sinh access key trong template.

Luyện thêm hơn 700 câu trên Servisphere →

Câu hỏi thường gặp

IAM user, group và role khác nhau thế nào?

User là danh tính lâu dài có mật khẩu hoặc access key. Group gom user để gán quyền chung. Role không có mật khẩu cố định mà được "đảm nhận" để nhận quyền tạm thời, dùng cho dịch vụ AWS (như EC2, Lambda), cho tài khoản khác hoặc cho người đăng nhập qua SSO.

Có nên dùng tài khoản root hằng ngày không?

Không. Root có toàn quyền và không bị giới hạn bởi policy. Chỉ dùng root cho vài việc bắt buộc, bật MFA, không tạo access key cho root, và dùng user hoặc SSO với quyền tối thiểu cho công việc hằng ngày.

IAM có tính phí không?

Không. IAM miễn phí; bạn chỉ trả cho tài nguyên mà các danh tính đó sử dụng.

Đề thi AWS hay hỏi gì về IAM?

Nguyên tắc quyền tối thiểu, cách đánh giá policy (Deny rõ ràng luôn thắng), dùng role cho EC2 hay Lambda thay vì để access key trong code, truy cập chéo tài khoản bằng role, MFA, và permission boundary.

Dịch vụ liên quan

Mở IAM trên bản đồ →