Tuần 3 - Ngày 2: Multi-Account Patterns
Mục tiêu học tập
- Hiểu các multi-account patterns phổ biến
- Nắm vững cách thiết kế account structure
- Biết cross-account access patterns
1. Tại sao cần Multi-Account?
Single Account Problems
Benefits of Multi-Account
2. Common Account Patterns
Pattern 1: Environment-based
Pattern 2: Team-based
Pattern 3: Application-based
3. AWS Landing Zone Pattern
Recommended Structure
4. Cross-Account Access
Method 1: IAM Roles (Recommended)
Trust Policy (Account B):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "unique-external-id"
}
}
}
]
}
Method 2: Resource-based Policies
Bucket Policy (Account B):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:user/username"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}
When to use which?
| Scenario | Method |
|---|---|
| Access multiple resources | IAM Role |
| Temporary access | IAM Role |
| Single resource access | Resource Policy |
| S3, SQS, SNS, KMS | Either |
| Audit requirements | IAM Role (better audit) |
5. Centralized Services Pattern
Centralized Logging
Centralized Security
Centralized Network
6. Account Vending
AWS Service Catalog
AWS Control Tower Account Factory
7. Câu hỏi ôn tập
-
3 common multi-account patterns là gì?
Xem đáp án
(1) Environment separation: Prod, Dev, Test, Staging trong separate accounts — blast radius isolation, different IAM policies per environment. (2) Workload/team separation: mỗi team hay product trong account riêng — ownership clarity, independent billing, IAM isolation. (3) Security/Shared services: dedicated accounts cho Log Archive, Security/Audit, Network Hub, Shared Services (CI/CD, monitoring). Thường kết hợp cả 3 patterns.
-
Cross-account access bằng IAM Role cần gì ở cả 2 phía?
Xem đáp án
Account A (có role được assume): Role trust policy allow principal từ Account B assume role (
sts:AssumeRole). Account B (muốn assume role): Identity có IAM policy vớists:AssumeRolepermission trên role ARN của Account A. Cả hai điều kiện phải thỏa mãn — không thể bypass. Optionally: External ID trong trust policy cho additional security với 3rd-party vendors. -
Log Archive Account nên chứa những gì?
Xem đáp án
Tất cả audit/compliance logs: CloudTrail (Organization Trail ghi logs của mọi account), CloudWatch Logs (centralized), Config snapshots, S3 Access Logs, ALB Access Logs. Policies: S3 bucket policy chỉ cho phép append (không delete), Vault Lock trên AWS Backup, MFA delete trên S3 bucket. Access: chỉ Security/Compliance team có read access. Member accounts chỉ có write, không có delete.
-
Network Account thường manage những services nào?
Xem đáp án
Transit Gateway (hub routing giữa VPCs và on-premises), Direct Connect connections, AWS Network Firewall, Route 53 Resolver (central DNS), VPC Sharing (share subnets từ centralized VPC đến member accounts), NAT Gateways (centralized egress). Centralized networking giảm cost (không cần mỗi account có DX riêng), tăng visibility và control traffic flow.
-
Account vending machine hoạt động như thế nào?
Xem đáp án
Account Factory (trong Control Tower) tự động tạo accounts với: pre-configured guardrails, SSO access, baseline VPC, logging setup. Process: team fill form → Account Factory trigger Service Catalog → tạo AWS account mới → apply SCPs, baselines, SSO configuration → notify requester. Account ready to use trong phút thay vì days của manual process. Customizable với Account Factory Customization (hooks).
8. Bài tập thực hành
- Thiết kế multi-account structure cho công ty fictitious
- Setup cross-account role
- Configure centralized CloudTrail
- Explore Control Tower Account Factory
Tài liệu tham khảo chính thức
Ngày tiếp theo: IAM Identity Center (AWS SSO)