Rotating database passwords, patching AMIs, and distributing config files across dozens of instances gets painful when every team invents its own SSH-and-scp ritual. AWS Systems Manager (SSM) is the control plane AWS gives you to run those chores centrally—if you know which pieces to turn on first.
SSM is not a single product. Think of it as a family: Parameter Store for configuration, Session Manager for shell access without open SSH ports, Run Command for batched scripts, Patch Manager for OS updates, and State Manager for desired-state documents. Most engineering teams start with Session Manager plus Parameter Store, then expand when compliance asks for evidence.
Core services and when to use them
| Feature | Solves | Typical first user |
|---|---|---|
| Parameter Store | Encrypted and plain config values | App teams |
| Session Manager | Browser/CLI shells without bastions | SRE / security |
| Run Command | One-off or scheduled scripts on fleets | DevOps |
| Patch Manager | Baseline compliance on EC2 | Security ops |
| Inventory | OS and package metadata | FinOps / audit |
Nothing here replaces Infrastructure as Code. Terraform or CloudFormation still provisions instances; SSM operates on machines that already exist and report healthy.
The instance prerequisite everyone forgets
An EC2 instance only obeys SSM when:
- The SSM Agent is installed (Amazon Linux and many Windows AMIs include it).
- The instance can reach SSM endpoints (public internet via NAT, or VPC interface endpoints).
- The attached IAM instance profile includes
AmazonSSMManagedInstanceCore(or tighter custom policy).
If instances show as “not registered” in the Fleet Manager console, troubleshoot those three before chasing application bugs.
Minimal IAM instance profile
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:UpdateInstanceInformation",
"ssm:GetDocument",
"ssm:ListAssociations",
"ec2messages:*",
"ssmmessages:*"
],
"Resource": "*"
}
]
}
Attach via launch template so autoscaling groups inherit it automatically.
Parameter Store vs Secrets Manager
Both store secrets, but defaults differ:
- Parameter Store integrates cleanly with CloudFormation dynamic references and costs less at high read volume when you use standard parameters.
- Secrets Manager adds automatic rotation hooks for RDS and charges per secret-month.
A common pattern: non-rotating app config in Parameter Store (String), database credentials in Secrets Manager with Lambda rotation, both referenced from ECS task definitions or EC2 user data via SSM paths at boot.
Use SecureString with a customer-managed KMS key when auditors require key rotation evidence.
Session Manager without port 22
Session Manager tunnels shell access over HTTPS:
- No inbound security group rules for SSH
- Sessions logged to S3 or CloudWatch when you enable session logging
- IAM policies gate who can start a session on which instance tags
Enable logging early. Incident responders need transcripts more often than live access.
For developers, document how to run aws ssm start-session --target i-0123456789abcdef0 with your standard SSO profile. Hide instance IDs behind SSM session documents when possible.
Run Command for fleet-wide tasks
Need to clear cache files or collect logs from every app server?
- Write an SSM document (or use
AWS-RunShellScript). - Target instances by tag (
Environment=prod,Role=api). - Review output in the console or forward to S3.
Throttle concurrency so you do not restart every JVM at once. Maintenance windows help.
State Manager associations can enforce “must have file X with checksum Y” on a schedule—lightweight compliance without a full config management server.
Patch Manager in regulated environments
Patch baselines define which KBs or yum updates are approved. Maintenance windows schedule application. Reports land in S3 for auditors who ask “prove March CVEs were addressed.”
Pair Patch Manager with golden AMIs: bake quarterly, patch weekly in place between bake cycles.
VPC endpoints for private subnets
If instances lack public IPs, create interface endpoints for:
com.amazonaws.region.ssmcom.amazonaws.region.ec2messagescom.amazonaws.region.ssmmessages
Otherwise agents never check in and Run Command hangs at “Pending.”
Observability and alerting
CloudWatch metrics track command success rates and agent ping status. Create alarms when the count of managed instances drops suddenly—autoscaling events or IAM regressions often show up there first.
AWS Config rules can flag instances missing the SSM agent or required IAM policy, feeding your SOC dashboard.
Cost notes that surprise finance
Session Manager and basic Parameter Store usage are inexpensive relative to bespoke bastion hosts you still patch. Secrets Manager rotation Lambdas and high-frequency Parameter Store API calls can add up—model reads per task startup when you move .env files into SSM.
Retire unused parameters; orphaned /prod/old-service/ paths accumulate during rewrites.
Automating with Terraform and CI
Reference parameters in user data or container entrypoints:
data "aws_ssm_parameter" "api_config" {
name = "/prod/api/feature-flags"
}
resource "aws_ecs_task_definition" "api" {
container_definitions = jsonencode([{
name = "api"
image = var.image
environment = [{
name = "FEATURE_FLAGS"
value = data.aws_ssm_parameter.api_config.value
}]
}])
}
In CI, validate that required parameters exist before deploy (aws ssm get-parameter in a dry-run job). Failed lookups should block promotion instead of silently launching with empty strings.
Document naming conventions (/<env>/<service>/<key>) in your platform handbook so new microservices do not invent parallel hierarchies.
Migration path from bastion hosts
Week 1: Attach AmazonSSMManagedInstanceCore, verify Fleet Manager sees instances.
Week 2: Enable Session Manager logging, train on-call.
Week 3: Close SSH from 0.0.0.0/0 in security groups for pilot ASG.
Week 4: Move secrets from flat files to Parameter Store references in deploy scripts.
Week 5: Delete bastion ASG if audit approves.
Rollback plan: keep one bastion in a private subnet until two incident drills succeed over Session Manager alone.
Multi-account and Organizations
In AWS Organizations, central security teams often enable a delegated administrator for Systems Manager. They publish approved SSM documents in a shared services account while workload accounts execute Run Command only against tagged instances. RAM-shared parameters (AWS::SSM::Parameter) let platform teams expose approved AMIs IDs or golden config without copying secrets into every account.
When you assume roles across accounts, standardize the AWS-StartPortForwardingSession document for debugging databases through Session Manager instead of opening security groups between VPCs.
FAQ
Does SSM work on-prem?
Yes, with SSM Hybrid Activations for servers outside AWS.
Can I restrict commands by environment?
Use IAM condition keys on instance tags and separate SSM documents per tier.
How is this different from Ansible?
Ansible pushes desired state from a controller; SSM pulls via agent with AWS-native auth. Many teams use both: Terraform for infra, Ansible for app config, SSM for break-glass ops.
What about ECS and Fargate?
Tasks use task IAM roles and often pull config from Parameter Store at launch; Session Manager targets EC2-backed ECS, not Fargate tasks directly.
Is Run Command synchronous?
Invocations return quickly; output arrives asynchronously. Poll or use S3 output options in automation.
AWS SSM turns “SSH into prod and hope” into logged, IAM-bound operations that scale with your fleet. Wire the agent, endpoints, and instance profiles correctly once; every later security win—no open SSH, centralized secrets, patch evidence—stacks on that foundation.
Further Reading
Discover more articles on similar topics across our network


Comments
Loading comments…