Multi-Account Architecture with SCPs
هذا المشروع يوضح تصميم بنية تحتية AWS Organizations متكاملة لإدارة بيئة مؤسسية متعددة الحسابات باستخدام CloudFormation كـ Infrastructure as Code.
تشمل الهيكلة:
يحتوي على حسابي Prod-App و Prod-Data مع أعلى مستوى حماية: تشفير S3 إلزامي، MFA للعمليات الحرجة، حظر Root User.
يحتوي على حسابي Development و Testing مع تقييد المناطق وحظر الأجهزة المكلفة للتحكم بالتكاليف.
يحتوي على حسابي Security و Audit مع حظر Root User ومنع S3 العامة لحماية البيانات الحساسة.
يحتوي على حساب Sandbox للتجارب مع قيود صارمة على الأجهزة والخدمات المكلفة لمنع النفقات غير المخطط لها.
سياسة مطبقة على مستوى الجذر (Root) لمنع تعطيل أو حذف CloudTrail في جميع الحسابات الأعضاء بالمنظمة.
سياسة وسوم موحدة (Environment, Owner, CostCenter) على مستوى Root، وسياسة نسخ احتياطي يومي تلقائي على Production OU.
| # | اسم السياسة | الوصف | الهدف |
|---|---|---|---|
| 1 | RegionRestriction | تقييد العمليات على us-east-1 و us-west-2 فقط | Production Development |
| 2 | RequireS3Encryption | إلزام تشفير جميع ملفات S3 (AES256 / KMS) | Production |
| 3 | DenyRootUserAccess | حظر استخدام Root User بالكامل | Production Security |
| 4 | RequireMFA | إلزام MFA للعمليات التدميرية (حذف EC2, RDS, S3...) | Production |
| 5 | ProtectCloudTrail | منع تعطيل أو تعديل أو حذف CloudTrail | Root (كل المنظمة) |
| 6 | DenyExpensiveInstances | السماح فقط بـ t2/t3/t4g instances | Development |
| 7 | DenyPublicS3Buckets | منع إنشاء S3 Buckets عامة | Production Security |
| 8 | SandboxBudgetLimit | تقييد الأجهزة المكلفة وحظر RDS/Redshift/ES | Sandbox |
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS Organizations Multi-Account Setup with SCPs'
Resources:
ProductionOU:
Type: AWS::Organizations::OrganizationalUnit
Properties:
Name: Production
ParentId: !Ref OrganizationRootId
DevelopmentOU:
Type: AWS::Organizations::OrganizationalUnit
Properties:
Name: Development
ParentId: !Ref OrganizationRootId
RegionRestrictionSCP:
Type: AWS::Organizations::Policy
Properties:
Name: RegionRestriction
Type: SERVICE_CONTROL_POLICY
TargetIds:
- !Ref ProductionOU
- !Ref DevelopmentOU
RequireS3EncryptionSCP:
Type: AWS::Organizations::Policy
Properties:
Name: RequireS3Encryption
Type: SERVICE_CONTROL_POLICY
Content:
Version: '2012-10-17'
Statement:
- Sid: DenyUnencryptedS3Uploads
Effect: Deny
Action: s3:PutObject
Resource: '*'
Condition:
StringNotEquals:
s3:x-amz-server-side-encryption:
- AES256
- aws:kms
TargetIds:
- !Ref ProductionOU