Skip to content

Systems_manager


AWS Systems Manager is a unified interface that enables you to view and control your infrastructure on AWS. It provides operational insights and helps you manage applications and infrastructure.

AWS Systems Manager Overview
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | AWS Systems Manager | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | | |
| v v v v |
| +----------+ +----------+ +----------+ +----------+ |
| | Insights | | Actions | | Apps | | Change | |
| | | | | | Manager | | Manager | |
| | - Dash | | - Run | | - Deploy | | - Change | |
| | - Inventory| | Command| | - Config | | - Request| |
| | - Comp | | - Patch | | | | - Approve| |
| +----------+ +----------+ +----------+ +----------+ |
| |
+------------------------------------------------------------------+
CapabilityDescription
InsightsDashboard, Inventory, Compliance
ActionsRun Command, Automation, Patch Manager
ApplicationsApplication Manager, Parameter Store
Change ManagementChange Calendar, Change Templates

Systems Manager Node Management
+------------------------------------------------------------------+
| |
| Managed Instances |
| +------------------------------------------------------------+ |
| | | |
| | Requirements: | |
| | +------------------------------------------------------+ | |
| | | - SSM Agent installed | | |
| | | - IAM role with SSM permissions | | |
| | | - Network connectivity to SSM endpoints | | |
| | +------------------------------------------------------+ | |
| | | |
| | Supported Platforms: | |
| | +------------------------------------------------------+ | |
| | | - Amazon EC2 (Linux, Windows) | | |
| | | - On-premises servers (hybrid) | | |
| | | - Edge devices (IoT) | | |
| | | - EC2 Spot Instances | | |
| | +------------------------------------------------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
| Hybrid Activation |
| +------------------------------------------------------------+ |
| | | |
| | Steps to activate on-premises servers: | |
| | +------------------------------------------------------+ | |
| | | 1. Create activation in SSM | | |
| | | 2. Install SSM Agent on server | | |
| | | 3. Register server with activation code | | |
| | | 4. Server appears as managed instance | | |
| | +------------------------------------------------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
Session Manager Architecture
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | Session Manager | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | |
| v v v |
| +----------+ +----------+ +----------+ |
| | Browser | | CLI | | SSH | |
| | Access | | Access | | Access | |
| | | | | | | |
| | - No SSH | | - AWS | | - Port | |
| | keys | | CLI | | 22 | |
| | - Audit | | - Plugin | | closed | |
| | logs | | | | | |
| +----------+ +----------+ +----------+ |
| | | | |
| +---------------------+---------------------+ |
| | |
| v |
| +------------------------+ |
| | Managed Instance | |
| +------------------------+ |
| |
+------------------------------------------------------------------+
Session Manager Benefits
+------------------------------------------------------------------+
| |
| Security Benefits |
| +------------------------------------------------------------+ |
| | - No SSH ports open (port 22 closed) | |
| | - No bastion hosts required | |
| | - No SSH keys to manage | |
| | - IAM-based access control | |
| +------------------------------------------------------------+ |
| |
| Compliance Benefits |
| +------------------------------------------------------------+ |
| | - Session logging to S3 | |
| | - Session logging to CloudWatch | |
| | - Audit trail of all commands | |
| | - Session recording available | |
| +------------------------------------------------------------+ |
| |
| Operational Benefits |
| +------------------------------------------------------------+ |
| | - One-click access from console | |
| | - Cross-platform support (Linux, Windows) | |
| | - No firewall changes needed | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Run Command Architecture
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | Run Command | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | |
| v v v |
| +----------+ +----------+ +----------+ |
| | Documents| | Targets | | Execution| |
| | | | | | | |
| | - AWS | | - Tags | | - Rate | |
| | owned | | - Instance| | Control| |
| | - Custom | | IDs | | - Concurrent |
| +----------+ +----------+ +----------+ |
| |
+------------------------------------------------------------------+
Common SSM Documents
+------------------------------------------------------------------+
| |
| AWS-Managed Documents |
| +------------------------------------------------------------+ |
| | | |
| | Command Documents: | |
| | +------------------------------------------------------+ | |
| | | - AWS-RunShellScript (Linux) | | |
| | | - AWS-RunPowerShellScript (Windows) | | |
| | | - AWS-UpdateSSMAgent | | |
| | | - AWS-InstallPatchBaseline | | |
| | | - AWS-ConfigureDocker | | |
| | | - AWS-RunAnsiblePlaybook | | |
| | | - AWS-RunChefRecipe | | |
| | +------------------------------------------------------+ | |
| | | |
| | Automation Documents: | |
| | +------------------------------------------------------+ | |
| | | - AWS-UpdateLinuxAmi | | |
| | | - AWS-UpdateWindowsAmi | | |
| | | - AWS-CreateImage | | |
| | +------------------------------------------------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
Terminal window
# Send command to instances by tag
aws ssm send-command \
--document-name "AWS-RunShellScript" \
--document-version "1" \
--targets '[{"Key":"tag:Environment","Values":["Production"]}]' \
--parameters '{"commands":["sudo yum update -y","sudo reboot"]}' \
--timeout-seconds 600 \
--max-concurrency "50%" \
--max-errors "0"
# Send command to specific instances
aws ssm send-command \
--document-name "AWS-RunPowerShellScript" \
--instance-ids "i-1234567890abcdef0" \
--parameters '{"commands":["Get-Service","Get-Process"]}'
# List commands
aws ssm list-commands
# Get command invocation details
aws ssm get-command-invocation \
--command-id "cmd-123" \
--instance-id "i-1234567890abcdef0"
# Cancel command
aws ssm cancel-command \
--command-id "cmd-123"

Systems Manager Automation
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | Automation | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | |
| v v v |
| +----------+ +----------+ +----------+ |
| | Documents| | Executions| | Actions | |
| | | | | | | |
| | - Steps | | - Start | | - AWS: | |
| | - Inputs | | - Stop | | Change | |
| | - Outputs| | - Resume | | Instance| |
| +----------+ +----------+ +----------+ |
| |
+------------------------------------------------------------------+
schemaVersion: '0.3'
description: 'Update Linux AMI with latest packages'
assumeRole: '{{AutomationAssumeRole}}'
parameters:
SourceAmiId:
type: String
description: 'Source AMI ID'
InstanceIamRole:
type: String
description: 'IAM role for instance'
TargetAmiName:
type: String
description: 'Name for new AMI'
default: 'UpdatedLinuxAmi-{{global:DATE}}'
mainSteps:
- name: launchInstance
action: 'aws:runInstances'
inputs:
ImageId: '{{ SourceAmiId }}'
InstanceType: t3.medium
IamInstanceProfile:
Name: '{{ InstanceIamRole }}'
MinInstances: 1
MaxInstances: 1
outputs:
- name: InstanceId
selector: '$.Instances[0].InstanceId'
type: String
- name: updateInstance
action: 'aws:runCommand'
inputs:
DocumentName: AWS-RunShellScript
InstanceIds:
- '{{ launchInstance.InstanceId }}'
Parameters:
commands:
- sudo yum update -y
- name: createImage
action: 'aws:createImage'
inputs:
InstanceId: '{{ launchInstance.InstanceId }}'
Name: '{{ TargetAmiName }}'
outputs:
- name: ImageId
selector: '$.ImageId'
type: String
- name: terminateInstance
action: 'aws:changeInstanceState'
inputs:
InstanceIds:
- '{{ launchInstance.InstanceId }}'
DesiredState: terminated
outputs:
- createImage.ImageId

Patch Manager Architecture
+------------------------------------------------------------------+
| |
| +------------------------+ |
| | Patch Manager | |
| +------------------------+ |
| | |
| +---------------------+---------------------+ |
| | | | |
| v v v |
| +----------+ +----------+ +----------+ |
| | Patch | | Patch | | Patch | |
| | Baselines| | Groups | | Scans | |
| | | | | | | |
| | - OS | | - Tags | | - Scan | |
| | Patches| | - Schedule| | - Install| |
| | - Custom | | | | - Report | |
| +----------+ +----------+ +----------+ |
| |
+------------------------------------------------------------------+
Patch Baseline Configuration
+------------------------------------------------------------------+
| |
| AWS-Managed Patch Baselines |
| +------------------------------------------------------------+ |
| | | |
| | - AWS-AmazonLinux2DefaultPatchBaseline | |
| | - AWS-UbuntuDefaultPatchBaseline | |
| | - AWS-RHELDefaultPatchBaseline | |
| | - AWS-CentOSDefaultPatchBaseline | |
| | - AWS-WindowsDefaultPatchBaseline | |
| | | |
| +------------------------------------------------------------+ |
| |
| Custom Patch Baseline |
| +------------------------------------------------------------+ |
| | | |
| | Configuration: | |
| | +------------------------------------------------------+ | |
| | | - Operating system (Linux/Windows) | | |
| | | - Approved patches | | |
| | | - Rejected patches | | |
| | | - Classification filters (Security, Bugfix, etc.) | | |
| | | - Severity levels | | |
| | | - Auto-approval rules | | |
| | +------------------------------------------------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Parameter Store Hierarchy
+------------------------------------------------------------------+
| |
| / (root) |
| |-- /my-application |
| | |-- /production |
| | | |-- /database |
| | | | |-- /host |
| | | | |-- /port |
| | | | |-- /username |
| | | | |-- /password (SecureString) |
| | | |-- /api |
| | | |-- /key (SecureString) |
| | |-- /development |
| | |-- /database |
| | |-- /host |
| | |-- /password (SecureString) |
| |-- /aws |
| | |-- /service |
| | |-- /ami-amazon-linux-latest |
| | |-- /amzn2-ami-hvm-x86_64-gp2 |
| |
+------------------------------------------------------------------+
Parameter Store Types
+------------------------------------------------------------------+
| |
| String |
| +------------------------------------------------------------+ |
| | - Plain text values | |
| | - No encryption | |
| | - Example: /app/config/timeout = "30" | |
| +------------------------------------------------------------+ |
| |
| StringList |
| +------------------------------------------------------------+ |
| | - Comma-separated values | |
| | - No encryption | |
| | - Example: /app/regions = "us-east-1,us-west-2,eu-west-1" | |
| +------------------------------------------------------------+ |
| |
| SecureString |
| +------------------------------------------------------------+ |
| | - Encrypted using KMS | |
| | - For sensitive data | |
| | - Example: /app/db/password = "MySecretPassword123" | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Systems Manager Inventory
+------------------------------------------------------------------+
| |
| Collected Data |
| +------------------------------------------------------------+ |
| | | |
| | Application Data: | |
| | +------------------------------------------------------+ | |
| | | - Installed applications | | |
| | | - Application versions | | |
| | | - Install dates | | |
| | +------------------------------------------------------+ | |
| | | |
| | Instance Data: | |
| | +------------------------------------------------------+ | |
| | | - Instance ID, type, region | | |
| | | - Operating system | | |
| | | - IP addresses | | |
| | | - Security groups | | |
| | +------------------------------------------------------+ | |
| | | |
| | Network Data: | |
| | +------------------------------------------------------+ | |
| | | - Network configuration | | |
| | | - Open ports | | |
| | | - DNS settings | | |
| | +------------------------------------------------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Terminal window
# Describe instance information
aws ssm describe-instance-information
# Send command
aws ssm send-command \
--document-name "AWS-RunShellScript" \
--instance-ids "i-1234567890abcdef0" \
--parameters '{"commands":["ls -la"]}'
# Get command invocation
aws ssm get-command-invocation \
--command-id "cmd-123" \
--instance-id "i-1234567890abcdef0"
# Start session
aws ssm start-session \
--target "i-1234567890abcdef0"
# Terminate session
aws ssm terminate-session \
--session-id "session-123"
# Put parameter
aws ssm put-parameter \
--name "/app/db/host" \
--value "db.example.com" \
--type String
# Get parameter
aws ssm get-parameter \
--name "/app/db/host"
# Get parameter (with decryption)
aws ssm get-parameter \
--name "/app/db/password" \
--with-decryption
# Get parameters by path
aws ssm get-parameters-by-path \
--path "/app/production" \
--recursive
# Create activation (hybrid)
aws ssm create-activation \
--default-instance-name "MyServer" \
--iam-role "SSMServiceRole"
# Start automation execution
aws ssm start-automation-execution \
--document-name "AWS-UpdateLinuxAmi" \
--parameters '{"SourceAmiId":["ami-12345678"]}'
# Describe automation executions
aws ssm describe-automation-executions
# Create patch baseline
aws ssm create-patch-baseline \
--name "MyPatchBaseline" \
--operating-system AMAZON_LINUX_2 \
--approval-rules PatchRules='[{PatchFilterGroup={PatchFilters=[{Key=CLASS,Values=[Security]}]},ApproveAfterDays=7}]'

Systems Manager Best Practices
+------------------------------------------------------------------+
| |
| 1. Use Session Manager instead of SSH |
| +------------------------------------------------------------+ |
| | - No open ports required | |
| | - Audit logging enabled | |
| +------------------------------------------------------------+ |
| |
| 2. Use Parameter Store for configuration |
| +------------------------------------------------------------+ |
| | - Centralize configuration | |
| | - Use SecureString for secrets | |
| +------------------------------------------------------------+ |
| |
| 3. Implement patch baselines |
| +------------------------------------------------------------+ |
| | - Regular patching schedule | |
| | - Test patches before production | |
| +------------------------------------------------------------+ |
| |
| 4. Use Automation for common tasks |
| +------------------------------------------------------------+ |
| | - Automate AMI creation | |
| | - Automate instance updates | |
| +------------------------------------------------------------+ |
| |
| 5. Enable Inventory collection |
| +------------------------------------------------------------+ |
| | - Track software inventory | |
| | - Monitor compliance | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Exam Tip

Key Exam Points
+------------------------------------------------------------------+
| |
| 1. Session Manager provides secure shell access without SSH |
| |
| 2. Run Command executes commands on managed instances |
| |
| 3. Automation automates operational tasks |
| |
| 4. Patch Manager manages OS patching |
| |
| 5. Parameter Store stores configuration and secrets |
| |
| 6. Managed instances require SSM Agent and IAM role |
| |
| 7. Hybrid activation enables on-premises management |
| |
| 8. Inventory collects system metadata |
| |
| 9. Documents define actions (AWS-owned or custom) |
| |
| 10. State Manager maintains configuration state |
| |
+------------------------------------------------------------------+

Chapter 35 Summary
+------------------------------------------------------------------+
| |
| Systems Manager Core Capabilities |
| +------------------------------------------------------------+ |
| | - Insights: Dashboard, Inventory, Compliance | |
| | - Actions: Run Command, Automation, Patch Manager | |
| | - Applications: Parameter Store, Application Manager | |
| | - Change Management: Change Calendar, Templates | |
| +------------------------------------------------------------+ |
| |
| Key Components |
| +------------------------------------------------------------+ |
| | - Session Manager: Secure shell access | |
| | - Run Command: Execute commands on instances | |
| | - Automation: Automate operational tasks | |
| | - Patch Manager: OS patching | |
| | - Parameter Store: Configuration management | |
| +------------------------------------------------------------+ |
| |
| Requirements for Managed Instances |
| +------------------------------------------------------------+ |
| | - SSM Agent installed | |
| | - IAM role with SSM permissions | |
| | - Network connectivity to SSM endpoints | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+

Previous Chapter: Chapter 34: AWS CDK - Cloud Development Kit Next Part: Part 8: Monitoring & Logging