</>Học Dev
Bài học

Tuần 3 - Ngày 4: AWS Resource Access Manager (RAM)

Tuần 3 – Ngày 4

Tuần 3 - Ngày 4: AWS Resource Access Manager (RAM)

Mục tiêu học tập

  • Hiểu cách hoạt động của AWS RAM
  • Nắm vững các resource types có thể share
  • Biết patterns để share resources across accounts

1. Tổng quan AWS RAM

Định nghĩa

AWS Resource Access Manager cho phép share AWS resources giữa các accounts mà không cần duplicate resources.

Benefits

WithoutRAM:WithRAM:AccountAccountAccountAAB(Owner)VPCVPCVPCSubnetSubnetSubnetDuplicateSharedCost:2xAccountB(Participant)UsessharedsubnetCost:1x

2. Shareable Resource Types

Networking

ResourceShare WithUse Case
VPC SubnetsOrg/AccountsCentralized VPC
Transit GatewayOrg/AccountsNetwork hub
Prefix ListsOrg/AccountsIP management
Route 53 Resolver RulesOrg/AccountsDNS forwarding
Traffic Mirror TargetsAccountsNetwork monitoring

Compute & Storage

ResourceShare WithUse Case
EC2 Capacity ReservationsOrg/AccountsReserved capacity
EC2 Dedicated HostsOrg/AccountsLicense compliance
License ManagerOrg/AccountsLicense tracking
Aurora DB ClustersAccountsShared database

Other Services

ResourceShare WithUse Case
AWS OutpostsOrg/AccountsEdge computing
CodeBuild ProjectsOrg/AccountsShared builds
Glue CatalogsOrg/AccountsData lake
App MeshOrg/AccountsService mesh

3. Sharing Patterns

Pattern 1: VPC Subnet Sharing

NetworkAccount(ResourceOwner)SharedVPCSubnetASubnetB(Shared)(Shared)AccountAAccountB(Participant)(Participant)Candeploy:Candeploy:-EC2instances-Lambda-RDSinstances-ECStasks-ELB-ElastiCache

Pattern 2: Transit Gateway Sharing

NetworkAccountTransitGateway(Shared)ProdDevTestAccountAccountAccountVPC-ProdVPC-DevVPC-TestAttachmentAttachment

Pattern 3: Aurora Sharing (Cross-Account Clone)

AccountA(Owner)AccountB(Participant)AuroraClusterAuroraClonePrimary(Read-onlyShareinitially)

4. Resource Share Configuration

Creating a Resource Share

Step1:CreateResourceShareResourceShare:"Shared-Network-Resources"Resources:-subnet-aaaa(Production)-subnet-bbbb(Development)Principals:-arn:aws:organizations::123:ou/ou-xxx-444455556666(specificaccount)

Sharing Options

WithinOrganization:EnablesharingwithinOrganizationAutomaticallyacceptinvitations(Nomanualacceptanceneeded)OutsideOrganization:SharewithexternalaccountAccountID:999988887777Requiresmanualacceptance

5. Permissions & Ownership

Resource Ownership

Resource Owner (Account A):
- Full control over resource
- Can modify, delete resource
- Can update resource share
- Pays for resource

Participant (Account B):
- Can use/reference resource
- Cannot modify shared resource
- Can create resources in shared subnet
- Pays for own resources

VPC Subnet Sharing Specifics

Owner Account:
- Manages VPC, subnets, route tables
- Manages NACL
- Manages VPC endpoints
- Manages Flow logs

Participant Account:
- Can launch EC2, RDS, ELB, etc. in shared subnet
- Manages Security Groups (own resources)
- Cannot see other participant's resources
- Cannot modify network configuration

6. Best Practices

1. Use Organizations for Sharing

Benefits:
- Automatic acceptance
- Centralized management
- Easy auditing

Configuration:
Organizations → Services → RAM → Enable

2. Tag Resources

{
  "Tags": [
    {"Key": "SharedWith", "Value": "prod-ou"},
    {"Key": "Owner", "Value": "network-team"},
    {"Key": "Purpose", "Value": "centralized-networking"}
  ]
}

3. Use Separate Resource Shares

Good:NetworkResourcesComputeResources-Subnets-CapacityRes.-TransitGW-DedicatedHostsBad:AllSharedResources-Subnets,TransitGW,CapacityReservations(Hardtomanage,audit)

7. Common Use Cases

Use Case 1: Centralized VPC for Compliance

Requirement: All production resources in compliant network

Solution:
- Network Account owns VPC with compliance controls
- Share subnets to production accounts
- All resources inherit network controls

Use Case 2: Shared Transit Gateway

Requirement: Connect 50 VPCs across accounts

Solution:
- Create Transit Gateway in Network Account
- Share via RAM to Organization
- Each account attaches their VPC
- Centralized routing management

Use Case 3: License Management

Requirement: Track software licenses across accounts

Solution:
- Create license configurations in central account
- Share via RAM
- Accounts consume licenses
- Centralized tracking and compliance

8. Câu hỏi ôn tập

  1. AWS RAM có thể share những resource types nào?

    Xem đáp án

    RAM hỗ trợ sharing nhiều resource types: VPC Subnets (phổ biến nhất), Transit Gateway, Route 53 Resolver Rules, Aurora DB Clusters, EC2 Capacity Reservations, License Manager configurations, AWS Network Firewall policies, CodeBuild Projects, Glue Data Catalog, và nhiều hơn (~100 resource types). Mỗi resource type có rules riêng về sharing scope (Organization-only vs external).

  2. Owner account và Participant account có quyền gì khác nhau?

    Xem đáp án

    Owner: tạo, modify, delete shared resource. Xem tất cả usage của resource kể cả từ participants. Participant: dùng resource nhưng không thể modify hoặc delete. Ví dụ VPC Subnet: participant deploy EC2, RDS vào subnet nhưng không thể modify subnet CIDR hay route table. Resource billing vẫn về owner account — participant không trả tiền cho shared resource (trả tiền resource họ deploy trong đó).

  3. Sharing within Organization có gì khác với outside?

    Xem đáp án

    Within Organization: không cần accept invitation — sharing tự động khi organizations sharing enabled. Outside Organization (account ngoài): phải gửi invitation, recipient phải accept trước khi có thể use shared resources. Cross-organization sharing có thể không được cho phép tùy organization policy. Một số resource types chỉ có thể share within Organization (như Route 53 Resolver Rules).

  4. Khi share VPC subnet, ai manage Security Groups?

    Xem đáp án

    Mỗi account tự manage Security Groups của mình. Owner manage Security Groups thuộc owner account; participant manage SGs trong participant account. Tuy nhiên: participant có thể reference SG của owner account trong rules (và ngược lại) bằng SG ID. Resources của participant và owner có thể giao tiếp qua private IP trong shared subnet nếu SG rules cho phép.

  5. Best practices khi dùng RAM là gì?

    Xem đáp án

    (1) Enable Organizational sharing để tránh manual invitations, (2) Audit resource shares thường xuyên — xem ai đang dùng shared resources, (3) Use tagging để track shared resources, (4) Prefer Organization-scoped sharing over individual account sharing để quản lý dễ hơn, (5) Network Account nên own shared subnets/Transit Gateway — centralized ownership, (6) Monitor shared resource usage qua CloudTrail và AWS Config.

9. Bài tập thực hành

  • Create resource share for subnet
  • Share Transit Gateway across accounts
  • Test launching EC2 in shared subnet
  • Review RAM quotas và limits

Tài liệu tham khảo chính thức


Ngày tiếp theo: AWS Control Tower