This lesson combines 4 topics: Amazon CloudWatch, CloudTrail and AWS Config, AWS Systems Manager (SSM), AWS Organizations Basics.
Learning Objectives
- Understand CloudWatch: metrics, logs, alarms, dashboards
- Master custom metrics, log groups, Logs Insights
- Apply CloudWatch Alarms for monitoring
- Distinguish CloudTrail vs Config vs CloudWatch
- Understand CloudTrail event types and trails
- Master AWS Config rules and remediation
- Understand the SSM ecosystem
- Master Session Manager, Patch Manager, Run Command, Parameter Store
- Apply SSM to EC2 + on-prem management
- Understand AWS Organizations and multi-account setup
- Master OU (Organizational Unit) structure
- Understand the basics of Service Control Policies (SCP)
- Distinguish Consolidated Billing and Volume Discounts
Part 1: Amazon CloudWatch
1. CloudWatch Overview
CloudWatch = centralized monitoring service for AWS resources and applications.
4 main components
- Metrics: time-series data points
- Logs: collect, store, analyze logs
- Alarms: alert when a metric crosses a threshold
- Dashboards: visualize metrics
Use cases
- Monitor EC2 CPU, RDS connections, Lambda invocations
- Centralize application logs
- Alert on system anomalies
- Auto-scaling triggers
- Build operations dashboards
2. CloudWatch Metrics
Built-in metrics
- EC2: CPU, NetworkIn/Out, DiskReadOps (no memory by default — need agent)
- RDS: DatabaseConnections, FreeStorageSpace, CPUUtilization
- S3: BucketSizeBytes, NumberOfObjects (daily)
- Lambda: Invocations, Errors, Duration, Throttles
- ELB: RequestCount, TargetResponseTime, HTTPCode_Target_4XX_Count
Custom metrics
- Push custom metrics via API:
PutMetricData - Dimensions: extra context (e.g., instance ID, environment)
cloudwatch.put_metric_data(
Namespace='MyApp',
MetricData=[{
'MetricName': 'OrdersProcessed',
'Value': 100,
'Unit': 'Count',
'Dimensions': [
{'Name': 'Environment', 'Value': 'prod'}
]
}]
)
High-Resolution metrics
- Standard: 60-second granularity
- High-resolution: 1-second granularity (extra cost)
Retention
- 1-minute: retained 15 days
- 5-minute: 63 days
- 1-hour: 455 days (15 months)
3. CloudWatch Logs
Components
- Log Group: container (e.g.,
/aws/lambda/my-function) - Log Stream: source within group (e.g., per instance)
- Log Events: timestamped log lines
Sources
- Lambda (automatic)
- ECS, EKS (configurable)
- CloudWatch Agent on EC2
- VPC Flow Logs
- Route 53 query logs
- API Gateway access logs
- ALB access logs (to S3, then to CloudWatch)
- Custom: API or SDK
Retention
- Configurable per log group: 1 day - 10 years - Never expire
- Default: Never expire (cost grows!)
Logs Insights
- Query language for log analysis
- Example: count errors per minute
fields @timestamp, @message
| filter @message like /ERROR/
| stats count() by bin(1m)
4. CloudWatch Agent
Definition
CloudWatch Agent = installed on EC2/on-prem to collect:
- Memory utilization (not default in CloudWatch)
- Disk usage, I/O
- Network detailed metrics
- Custom logs (
/var/log/myapp.log)
Setup
- Install CloudWatch Agent
- Configure via JSON or SSM Parameter Store
- Start agent → metrics + logs flow
5. CloudWatch Alarms
States
- OK: metric within threshold
- ALARM: metric breached threshold
- INSUFFICIENT_DATA: not enough data
Configuration
- Metric: which to monitor
- Threshold: condition (>, <, =)
- Period: evaluation period (1 min, 5 min, etc.)
- Datapoints to alarm: 3 out of 5 periods (avoid false alarm)
- Actions: SNS, SSM auto-remediation, Auto Scaling, EC2 actions
Actions
- SNS notification (email, SMS)
- Auto Scaling (scale in/out)
- EC2 Action (stop, terminate, reboot, recover)
- Systems Manager (run automation document)
Composite Alarm
- Combine multiple alarms with AND/OR
- Reduce alarm fatigue
6. Dashboards
Features
- Drag-and-drop widgets
- Line, stacked area, number, gauge, text
- Multiple regions in 1 dashboard
- Shareable
- Auto-refresh
Cost
- $3/dashboard/month (3 dashboards free)
7. CloudWatch Synthetics
Definition
Synthetics = scheduled scripts (canaries) test endpoint availability + UX.
Use case
- Monitor website uptime
- Test transaction flow (login, search, purchase)
- API endpoint health
- Alert on regression
Type
- Heartbeat (URL ping)
- API canary (REST API workflow)
- Broken link checker
- Visual monitoring (screenshot diff)
- GUI workflow
8. CloudWatch RUM (Real User Monitoring)
Definition
RUM = monitor end-user experience (browser performance, errors).
Captures
- Page load time
- JavaScript errors
- User journey
- Geographic distribution
Use case
- Web app performance monitoring
- A/B testing analytics
- Frontend troubleshooting
9. CloudWatch Anomaly Detection
Definition
ML auto-detects anomalies in metrics and alarms on deviation from the baseline.
Use case
- Detect unusual API call spikes
- Identify cost anomalies
- Catch performance regressions
10. Cross-Account, Cross-Region Observability
Definition
View metrics + logs from multiple accounts in 1 dashboard.
Setup
- Monitoring Account: receive data
- Source Accounts: send data
- Sink + Link configuration
Use case
- Centralized ops dashboard for organization
- Compliance reporting
11. CloudWatch Metric Math
Definition
Compute derived metrics from existing metrics.
Examples
e1 = m1 / m2 * 100 (error rate %)
e2 = sum(m1) (total over time)
e3 = m1 + m2 + m3 (aggregate)
Use case
- Custom KPIs
- Rate calculations
- Aggregation across resources
12. Pricing
- Metrics: $0.30/metric/month (custom) + $0.01/1000 API requests
- Logs: $0.50/GB ingested + $0.03/GB stored
- Alarms: $0.10/alarm/month
- Dashboards: $3/dashboard/month
Free tier
- 10 custom metrics
- 10 alarms
- 5 GB logs ingested
- 1M API requests
Part 2: CloudTrail and AWS Config
1. AWS CloudTrail
Definition
CloudTrail = audit log for API calls in an AWS account.
Key Features
- Enabled by default in every AWS account
- 90 days history in the console (Event History)
- You need to create a Trail to keep it longer (send to S3, CloudWatch Logs)
- Global service, but a trail can be regional or multi-region
Event types
| Type | Description |
|---|---|
| Management Events (default) | API calls on resources (CreateBucket, RunInstances, ...) |
| Data Events (paid) | API calls on data inside a resource (S3 GetObject, Lambda Invoke) |
| Insights Events | Unusual activity (ML detection) |
Use cases
- Security audit (who did what when)
- Compliance (SOC, PCI requires audit trail)
- Troubleshoot (what changed before incident)
- Investigation forensics
Trail Setup
- S3 bucket destination (encrypted recommended)
- Optional: send to CloudWatch Logs (for alarms on specific events)
- Optional: integrate with Amazon EventBridge (real-time response)
- Optional: integrate with Lake Formation for analysis
Multi-account / Organization Trail
- Single trail captures events from all accounts in Organization
- Storage in management account or dedicated logging account
- Use case: centralized audit log
2. CloudTrail Lake
Definition
CloudTrail Lake = managed data lake for CloudTrail events, queried via SQL.
Key Features
- Up to 7-year retention
- SQL queries on event data
- No need to configure S3 + Athena yourself
Use case
- Long-term audit retention
- Compliance investigation
- Ad-hoc audit queries
3. CloudTrail vs CloudWatch Logs
| CloudTrail | CloudWatch Logs | |
|---|---|---|
| Tracks | API calls (who did what) | Application logs |
| Sources | AWS API endpoints | Apps, services |
| Format | JSON CloudTrail events | Free-form text/JSON |
| Use case | Audit, compliance | Debug, monitor |
Best practice: send CloudTrail events to CloudWatch Logs to alarm on critical events.
4. AWS Config
Definition
AWS Config = continuous configuration tracking and compliance evaluation.
Key Features
- Records configuration changes of resources over time
- Configuration Items (CI): snapshot of resource state at point in time
- Configuration Timeline: visualize changes
- Configuration History: stored in S3
- Regional (enable per region)
What's tracked
- Configuration changes (EC2 SG modified, S3 bucket policy changed)
- Compliance status (resource meets rules?)
- Relationships (EC2 → EBS, EC2 → SG)
Config Rules
AWS Managed Rules
- 200+ pre-built rules
- Examples:
s3-bucket-public-read-prohibitediam-password-policyencrypted-volumesec2-instances-in-vpcrds-storage-encrypted
Custom Rules
- Lambda function evaluates resource
- Pass/fail logic
Compliance Status
- COMPLIANT: meets rule
- NON_COMPLIANT: violates rule
- Dashboard shows organization-wide compliance %
5. AWS Config Remediation
Manual remediation
- Engineer fixes non-compliant resource
Auto-remediation
- Trigger SSM Automation document on non-compliance
- Example: S3 bucket public → auto-disable public access
Use case
- Drift detection (resource changed outside IaC)
- Continuous compliance (auto-fix violations)
6. Config vs CloudTrail
| CloudTrail | Config | |
|---|---|---|
| What | API calls history | Resource configuration history |
| Question | "Who did X?" | "What is X's current state? How has it changed?" |
| Compliance | Detect actions | Detect state |
| Format | Events (chronological) | Configuration Items per resource |
Combined
- CloudTrail: "Bob disabled MFA at 3 PM"
- Config: "MFA was enabled, now disabled, configuration drift detected"
7. Multi-Account Config
Aggregator
- Aggregate compliance data from multiple accounts + regions
- View in 1 dashboard
- Setup via Organizations (auto-include new accounts)
8. Config Pricing
- $0.003 per configuration item recorded
- $0.001 per evaluation (rule check)
- Can be expensive in large org → use exclusion (don't record certain resources)
9. Common Patterns
Pattern 1: Track changes
- CloudTrail + Config
- Detect "who made change" + "what changed"
Pattern 2: Auto-remediate
Config rule "s3-bucket-public-read-prohibited" NON_COMPLIANT
→ SSM Automation
→ Block public access on bucket
→ Resource COMPLIANT
Pattern 3: Alert on critical IAM events
CloudTrail event "DeleteUser" or "CreateAccessKey"
→ CloudWatch Logs filter
→ Alarm → SNS to security team
Pattern 4: Compliance reporting (PCI, HIPAA)
- AWS Config rules per framework
- Aggregate across accounts
- Audit Manager → automated reports
10. Best Practices
CloudTrail
- Enable multi-region trail (catch all regions)
- Enable in management account of Organization (org-wide)
- Encrypt log files with KMS
- Validate file integrity (signed logs)
- Send to centralized account (security/log archive)
Config
- Enable in all regions
- Enable in all accounts (Organizations)
- Use Aggregator for centralized view
- Auto-remediation for known violations
- Monitor cost (configuration items can grow)
Part 3: AWS Systems Manager (SSM)
1. Systems Manager Overview
AWS Systems Manager (SSM) = unified interface to manage AWS + on-prem infrastructure.
Key Features
- Manage EC2 + on-prem servers
- No SSH keys needed (Session Manager)
- Centralized patch management
- Configuration as data (Parameter Store)
- Compliance scanning
- Operational insights
Requirements
- SSM Agent installed (preinstalled on Amazon Linux, Windows Server AMIs)
- IAM role attached (
AmazonSSMManagedInstanceCorepolicy) - Network connectivity to SSM endpoints (VPC Endpoint optional)
2. Key Capabilities
Session Manager
- Browser-based shell to EC2 + on-prem
- No SSH, no bastion host, no open ports
- Audit log of sessions to S3/CloudWatch
- IAM-controlled access
Benefits
- Security: no port 22 open
- Audit: every session logged
- Cross-OS: Linux SSH + Windows RDP
Run Command
- Execute commands on multiple instances without SSH
- Pre-defined documents (e.g.,
AWS-RunShellScript) - Targets: instance IDs, tags, resource groups
- Audit log via CloudTrail
Use cases
- Install software across fleet
- Apply patches
- Run scripts on Auto Scaling groups
Patch Manager
- Automated patching of OS + applications
- Patch baselines: rules for which patches to apply
- Patch groups: target instances by tag
- Maintenance windows: when to patch (off-hours)
- Cross-OS support
State Manager
- Maintain desired state of instances
- E.g., always ensure CloudWatch Agent installed
- Run on schedule (cron)
Inventory
- Collect software + config inventory from instances
- Centralized view of installed software, network config, files
- Use case: license tracking, compliance
Maintenance Windows
- Schedule maintenance tasks (patching, runbook)
- Cron-based
- Avoid disrupting production
Parameter Store
- Store configuration + secrets
- Already covered in Week 3 Day 1, Part 2
3. SSM Session Manager Setup
Basic setup
- Attach IAM role with
AmazonSSMManagedInstanceCoreto EC2 - SSM Agent running (default for AL2, Windows Server)
- Open AWS Console → SSM → Session Manager → Start session
Advantages over SSH
- No SSH key management
- No port 22 in Security Group
- No bastion host needed
- Audit trail
- Works with private subnet instances (no internet needed if VPC Endpoint configured)
Logging
- Configure to log session to CloudWatch Logs or S3
- Capture all commands + output
- Use case: compliance, forensics
4. Patch Manager
Patch Baselines
- AWS-managed baselines: per OS
- Custom baselines: customer-defined rules
- Approval rules: auto-approve critical patches after N days
Workflow
- Configure patch baseline
- Tag instances with
Patch Group - Define maintenance window (e.g., Sunday 2 AM)
- SSM applies patches during window
- Compliance report
Patch Compliance
- Compliance dashboard shows % patched
- Identify non-compliant instances
5. Run Command
Example: Install Apache on all EC2 with tag Role=web
aws ssm send-command \
--document-name "AWS-RunShellScript" \
--targets "Key=tag:Role,Values=web" \
--parameters 'commands=["yum install -y httpd","systemctl start httpd"]'
Built-in documents
AWS-RunShellScript(Linux)AWS-RunPowerShellScript(Windows)AWS-UpdateSSMAgentAWS-ConfigureAWSPackage(install AWS-distributed packages)
Custom documents
- YAML/JSON
- Reusable runbooks
6. Automation Documents
Definition
Automation documents = scripts orchestrate AWS actions (similar to Step Functions but simpler).
Use cases
- Patch + reboot fleet
- Snapshot all RDS at end of day
- Update AMI in Launch Templates
- Compliance remediation (via Config integration)
Trigger sources
- Manual execution
- Maintenance Windows
- EventBridge (event-driven automation)
- Config rules (remediation)
7. SSM Inventory
Collected data
- AWS components, applications, files, network config, services, Windows updates, Windows registry, Windows roles
Storage
- Aggregate to S3 via Resource Data Sync
- Query with Athena, visualize with QuickSight
Use case
- Software license tracking
- Vulnerability patching priority
- Compliance audit
8. AppConfig
Definition
AppConfig = manage application configuration changes (feature flags, gradual rollout).
Key Features
- Validation before deploy
- Gradual rollout (10%, 50%, 100%)
- Rollback if errors
- A/B testing
- Integrate with Lambda, ECS, EC2
Use case
- Feature flags
- Configuration changes without redeploy
- Canary config rollout
9. OpsCenter
Definition
OpsCenter = central place to view + investigate operational issues.
Aggregates
- Config compliance violations
- CloudWatch alarms
- AWS Health events
- Trusted Advisor recommendations
Use case
- Single pane of glass for ops team
10. Common Patterns
Pattern 1: SSH-less infrastructure
- No bastion host
- All access via Session Manager
- IAM-controlled per user
Pattern 2: Automated patching
- Tag instances by environment
- Patch Manager applies based on tags + baseline
- Maintenance window during off-hours
- Compliance dashboard tracks
Pattern 3: Config drift detection + auto-fix
- AWS Config rule "ssm-agent-installed"
- Non-compliant → trigger SSM Automation document
- Document installs SSM Agent
Pattern 4: Centralized configuration
- Parameter Store hierarchy:
/myapp/{env}/{component}/... - Apps fetch at runtime
- Update without redeploy
11. Multi-Account, Hybrid
Hybrid (on-prem)
- Install SSM Agent on-prem
- Register as managed instance (with activation code)
- Treat on-prem servers like EC2 in SSM
Multi-account
- IAM cross-account roles
- Run Command from management account to member accounts
- Resource Groups for grouping
Part 4: AWS Organizations Basics
1. Organizations Overview
AWS Organizations = service for managing multiple AWS accounts centrally.
Key Features
- Free service
- Hierarchical: Root → OUs → Accounts
- Consolidated billing: 1 invoice for all accounts
- Volume discounts: aggregate usage for discounts
- SCPs limit permissions across accounts
- Service integration: CloudTrail, Config, SSO, Backup, etc.
Why use Organizations
- Isolation: separate dev, staging, prod
- Billing: aggregate cost, get volume discounts
- Security: limit blast radius (1 account compromised ≠ all compromised)
- Compliance: separate compliance scopes (PCI account)
- Team autonomy: each team owns account
2. Components
Management Account (formerly Master)
- Creates organization
- Pays bill for all member accounts
- Cannot have SCPs apply to it (always full permissions)
- Should be only used for org management (not workload)
Member Accounts
- Created within organization (or invited from existing)
- Receive consolidated billing
- SCPs apply
Organizational Unit (OU)
- Logical group of accounts
- Up to 5 levels nesting
- Apply policies (SCP, tag policies) at OU level
3. Account Lifecycle
Create new account
- Console: "Add account" → AWS creates new account in org
- Email + name required
- IAM role
OrganizationAccountAccessRolecreated (assumable from management)
Invite existing account
- Send invitation to existing account
- Account owner accepts
- Joins organization (still owned by original owner)
Remove account
- Account leaves organization
- Must have own payment method
- Some accounts created in console must wait 7 days before can be removed
Close account
- Suspend account, delete resources after 90 days
- Cannot reopen
4. Service Control Policies (SCPs)
Definition
SCP = policy that limits maximum permissions for IAM users/roles in accounts.
Key Features
- Whitelist or blacklist style
- NOT grant permissions (just limit)
- Apply at the Root, OU, or Account
- Inheritance: child OU inherit parent's SCPs
- NOT apply to management account
- NOT apply to service-linked roles
Default SCP
- FullAWSAccess: allow everything (default attached)
- Can detach and attach more restrictive
Effective permissions
Effective permission = IAM identity policy ∩ SCP
= What both allow
Common SCPs
Deny specific regions
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": ["us-east-1", "us-west-2"]
}
}
}]
}
Prevent IAM user creation (force IAM Identity Center)
{
"Effect": "Deny",
"Action": ["iam:CreateUser", "iam:CreateAccessKey"],
"Resource": "*"
}
Prevent leaving organization
{
"Effect": "Deny",
"Action": "organizations:LeaveOrganization",
"Resource": "*"
}
Force MFA
{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"BoolIfExists": { "aws:MultiFactorAuthPresent": "false" }
}
}
5. Consolidated Billing
Benefits
- 1 invoice for entire organization
- Volume discounts: aggregate usage across accounts
- Reserved Instance sharing: RIs in 1 account benefit other accounts (configurable)
- Savings Plans sharing: similar
Example
- Account A uses 100 EC2 hours, Account B uses 200 hours
- Together = 300 hours → may qualify for next pricing tier discount
6. AWS Account Best Practices
Standard account structure
- Management Account (root): only org management
- Log Archive Account: centralized CloudTrail + Config logs
- Security Account: GuardDuty, Security Hub delegated admin
- Shared Services Account: IAM Identity Center, DNS, central networking
- Production OU: production workloads
- Non-Production OU: dev/test
- Sandbox OU: experimentation
Landing Zone
- AWS-managed solution: Control Tower
- Auto-setup standard org structure
- Guardrails (preventive + detective)
- Account Vending (template-based new account creation)
7. AWS Control Tower
Definition
Control Tower = managed service implement landing zone best practices.
Features
- Account Factory: vending machine for new accounts
- Pre-built guardrails (SCPs + Config rules)
- CloudTrail + Config centralized
- Service Catalog for self-service
- Free (resources used charged normally)
Guardrails
- Preventive (SCP-based): "Don't allow public S3 buckets"
- Detective (Config-based): "Flag if RDS not encrypted"
Use case
- Multi-account setup with best practices
- Compliance baseline
- Standardize new account provisioning
8. AWS RAM (Resource Access Manager)
Definition
RAM = share AWS resources across accounts (or within Organization).
Shareable resources
- VPC subnets (VPC Sharing)
- Transit Gateway
- Route 53 Resolver Rules
- License Manager configurations
- AWS Glue Data Catalog
- ACM Private CA
- Aurora DB Cluster, Lake Formation databases, etc.
Use case
- Centralized networking (1 account owns VPC, other accounts use subnets)
- Share AMIs, software licenses
- Cross-account database access
Sharing models
- Within Organization: easier setup (auto-trust)
- Cross-account standalone: invitation-based
9. Cross-Account Access Patterns
Pattern 1: Centralized logging
Pattern 2: Centralized security
Security Account = GuardDuty delegated admin
Security Hub aggregator
Members ──► Findings flow to Security Account
Pattern 3: Shared networking
Network Account owns VPC + Transit Gateway
Other accounts share subnets via RAM
Single point of egress, route control
Pattern 4: Cross-account workload
10. SCPs Best Practices
Strategy: Default-Allow vs Default-Deny
- Default-Allow (most common): Start with FullAWSAccess, add specific deny rules
- Default-Deny: Start empty, add specific allow rules (more restrictive)
Common SCP rules
- Deny disabling CloudTrail
- Deny deleting Organizations Config
- Deny IAM user creation (use SSO)
- Deny root user access keys
- Restrict regions
- Force encryption on EBS, S3
- Prevent leaving organization
Test SCPs in sandbox
- Test in non-prod OU first
- Use COUNT mode? No, SCPs are immediate. Use test OU.
11. Tag Policies
Definition
Tag Policies = enforce tagging standards across accounts.
Key Features
- Defines required tag keys + valid values
- Compliance check (not enforcement by default)
- Combined with SCPs to enforce (deny if not tagged)
Use case
- Cost allocation (require
CostCentertag) - Resource organization
- Compliance audit
Review Questions
-
Do EC2 default metrics include memory?
Show answer
No: EC2 default metrics have no memory or disk utilization. Default metrics only include: CPU Utilization, Network In/Out, Disk Read/Write (for instance store), Status Check metrics. Memory and disk space need the CloudWatch Agent installed on the instance to send custom metrics. This is a common point of confusion in the exam: an "EC2 memory metric" is not available without the agent.
-
What is the default CloudWatch Logs retention?
Show answer
Never expire (indefinite): by default logs are never deleted automatically and accumulate cost. Set a retention policy as soon as you create a log group: 1 day to 10 years. Best practice: set retention to match compliance requirements (HIPAA is often 7 years, many apps are fine with 90 days). You can export old logs to S3 before deleting.
-
What is a Composite Alarm used for?
Show answer
Combines multiple alarms using Boolean logic (AND/OR/NOT) into a single alarm. Example:
ALARM if (CPUAlarm AND MemoryAlarm)alerts only when both are in ALARM state, reducing noise. OrALARM if (HighCPU OR HighDisk)alerts when either one fires. Composite Alarms reduce alert fatigue: you do not receive each alert separately when they are correlated. -
What does CloudWatch Synthetics monitor?
Show answer
Synthetic monitoring: runs canary scripts (Node.js/Python) to simulate user behavior and monitor endpoints: (1) API availability and latency, (2) Website navigation flows (login → checkout), (3) Broken links, screenshot diffs. Canaries run on a schedule (cron) and alert when responses are wrong or latency is high. They detect issues proactively before real users do. Integrates with X-Ray for distributed tracing.
-
What is Anomaly Detection based on?
Show answer
A Machine Learning model trained on metric history that learns patterns (hourly, weekly, seasonal variations). The model creates an "expected band" for the metric. CloudWatch alerts when the metric value falls outside the band. Advantage: no need to set static thresholds (good for metrics that change over time). It needs at least 2 weeks of history for the model to be accurate. You can exclude scheduled maintenance windows from training.
-
How long does CloudTrail Event History in the console keep events?
Show answer
90 days in the CloudTrail console Event History (free). To keep them longer, create a Trail and send logs to S3; you can keep them indefinitely with S3 Lifecycle policies. For a trail, the first copy of management events per region is free; data events cost extra. Best practice: create a trail sending to S3 + enable CloudTrail Lake for queries.
-
Are CloudTrail Data Events free?
Show answer
No: Data Events cost extra (~$0.10/100K events). Management Events (control plane: CreateBucket, RunInstances, IAM changes...) are free for the first trail per region. Data Events are high-volume events such as S3 object-level operations (GetObject, PutObject), DynamoDB item-level operations, Lambda invocations. Consider the cost before enabling data events on high-traffic S3 buckets/DynamoDB tables.
-
Which question does CloudTrail answer vs Config?
Show answer
CloudTrail answers: "Who did what, and when?" (WHO + WHAT + WHEN): API calls, user activity. AWS Config answers: "What is the resource's current configuration? Is it compliant?" (WHAT STATE). Config tracks resource configuration changes over time and evaluates compliance rules. CloudTrail = audit log; Config = configuration history and compliance assessment. They are usually used together.
-
Through which service can a Config rule auto-remediate?
Show answer
AWS Systems Manager (SSM) Automation: a Config Remediation Action triggers an SSM Automation document to fix non-compliant resources automatically. Example: a rule detects a public S3 bucket → the remediation action runs an SSM automation that turns off public access. You can also use a custom Lambda function. Remediation can be manual (click a button) or automatic (triggered as soon as the resource is non-compliant).
-
In which account do you set up the centralized audit log for an Organization?
Show answer
A dedicated Security/Audit account (best practice per the AWS Organizations pattern). Create an Organization Trail from the management account → it writes logs from all member accounts to an S3 bucket in the audit account. Member accounts cannot disable the trail (when using an Organization Trail). The audit account is only for security/compliance: no workloads deployed, minimal permissions for developers.
- How does SSM Session Manager differ from SSH?
Show answer
Session Manager: (1) No need for port 22 to be open, no key pairs, (2) No bastion host needed, (3) Every session is logged (CloudWatch, S3), (4) Access is controlled through IAM (not SSH keys), (5) Works for instances in a private subnet without a public IP (via SSM endpoints). Traditional SSH needs inbound port 22, complex key management, little auditing. Session Manager is a zero-trust access approach.
- What is Patch Manager used for?
Show answer
Automatically patches the OS and software on EC2 instances (and on-premises servers). Define a Patch Baseline (list of approved/rejected patches by severity). A Maintenance Window schedules when patches are applied. The compliance report shows which instances are patched and which patches are missing. Supports Windows, Amazon Linux, Ubuntu, RHEL, SUSE. Reduces manual patch management effort across a fleet of instances.
- How can Run Command target instances?
Show answer
Run Command targets instances by: (1) Specific Instance IDs, (2) Resource Group tags (e.g., Environment=Production), (3) Tag key-value (e.g., Patch=true), (4) All managed instances in the account. It runs the same command on thousands of instances in parallel (controlled by rate) without SSH-ing into each one. Output is stored in S3 or CloudWatch Logs.
- How does Parameter Store differ from AppConfig?
Show answer
Parameter Store: key-value storage for config and secrets; values are String, SecureString (KMS-encrypted), StringList. Simple retrieval. AWS AppConfig: designed for feature flags and application configuration with deployment strategies (canary, linear rollout), validation (JSON schema, Lambda validator), and rollback if a CloudWatch alarm triggers. AppConfig does not crash apps with bad config; Parameter Store is simple key-value without deployment safety.
- Which AMIs have the SSM Agent preinstalled?
Show answer
The SSM Agent is preinstalled on: Amazon Linux 2, Amazon Linux 2023, Windows Server 2008-2022 AMIs from AWS. It is also on Ubuntu 16.04+ and RHEL 7.4+ AWS AMIs since 2017. Other AMIs or on-premises servers need a manual install. The instance also needs an IAM role with the AmazonSSMManagedInstanceCore policy and network access to SSM endpoints (via the internet or VPC Interface Endpoints).
- Does an SCP grant permissions?
Show answer
No: an SCP (Service Control Policy) only limits maximum permissions (guardrails); it does not grant permissions. The member account still needs its own IAM policies to have actual permissions. SCPs apply to all principals in the account (including the member's root user), but the management account is not subject to SCPs. An SCP is a "maximum permissions fence", not "grant permissions".
- Do SCPs apply to the management account?
Show answer
No: the management account (the Organization's root account) is not subject to SCPs, even an SCP at the root OU. That is why the best practice is: do not deploy workloads in the management account and minimize credentials for it. Use the management account only for billing, organization management, and Control Tower. Workloads are deployed in member accounts, which are governed by SCPs.
- How does consolidated billing give volume discounts?
Show answer
AWS counts the total usage of all member accounts in the Organization toward volume pricing tiers. Example S3: pricing drops above 50 TB, above 500 TB; consolidated billing combines the usage of 10 accounts and can reach a lower tier faster than each account alone. Reserved Instances and Savings Plans can also be shared between accounts in the Organization: one account's RI can apply to another account if it is not fully used.
- What does Control Tower set up automatically?
Show answer
AWS Control Tower automatically sets up: (1) Landing Zone: multi-account structure with a Log Archive account, Audit account, Security OU, Sandbox OU, (2) Guardrails (mandatory + optional SCPs + Config rules), (3) IAM Identity Center for SSO, (4) CloudTrail organization trail, (5) Config organization rules. It cuts setup time from weeks to hours. Ongoing governance through Account Factory for creating new accounts.
- Which resources does RAM share?
Show answer
AWS Resource Access Manager (RAM) shares: VPC Subnets (most common), Transit Gateway, Route 53 Resolver rules, Aurora DB clusters, EC2 Capacity Reservations, License Manager configurations, AWS Network Firewall policies. Sharing works only within the same AWS Organization (you need to enable Organizational sharing). RAM itself is free; you only pay for the shared resource. VPC Subnet sharing is the main pattern for centralizing networking.
Hands-on Exercises
Part 1: Amazon CloudWatch
- Create a CloudWatch Alarm: EC2 CPU > 80% for 5 minutes → SNS email
- Install the CloudWatch Agent on EC2, configure memory metrics
- Create a Log Group for Lambda, query it with Logs Insights
- Create a dashboard with 4 widgets (CPU, Memory, Disk, Network)
- Set up a Synthetics canary to monitor a website
- Push a custom metric from an app, alarm when it crosses a threshold
Part 2: CloudTrail and AWS Config
- Create a multi-region Trail, send to S3 + CloudWatch Logs
- Search Event History for recent "RunInstances" actions
- Enable Config, add the managed rule
s3-bucket-public-read-prohibited - Create a public bucket, observe Config flag it NON_COMPLIANT
- Set up auto-remediation: trigger an SSM doc when a bucket is public
- Set up a CloudWatch alarm: CloudTrail event "ConsoleLogin without MFA" → SNS
Part 3: AWS Systems Manager (SSM)
- Attach an IAM role with the SSM policy to EC2
- Connect via Session Manager (no SSH key needed)
- Run Command: install a package on 3 instances
- Set up a Patch Manager baseline + maintenance window
- Create a Parameter Store hierarchy for app config
- (Optional) Register an on-prem server with SSM
Part 4: AWS Organizations Basics
- Create an AWS Organization (needs a new account or the current account as management)
- Create OU "Development", invite/create a member account
- Apply SCP "DenyRegionsOutside_US"
- Test: a user in the member account cannot create resources in regions outside the US
- (Optional) Set up Control Tower on the Organization
References
- CloudWatch Documentation
- CloudWatch Agent
- Logs Insights
- Synthetics
- CloudTrail Documentation
- CloudTrail Lake
- AWS Config
- Config Rules
- Systems Manager Documentation
- Session Manager
- Patch Manager
- Run Command
- Parameter Store
- AWS Organizations
- SCPs
- Control Tower
- AWS RAM