Systems Manager via SDK Best Practices
Systems Manager rewards a handful of consistent habits across Parameter Store, Run Command, Automation, and Session Manager. Get the managed-instance prerequisite, targeting, and versioning right once, and the rest of your fleet operations stay predictable, auditable, and cheap to run.
Walk this list once now, then use it as a review checklist before shipping any code that touches Systems Manager.
- Each item is a rule stated positively, with a one-line rationale.
- Groups run roughly in the order you will touch them: configuration first, then execution, orchestration, access, and finally the cross-cutting IAM/cost habits.
- Check the boxes against your own code as a quick audit.
- Revisit whenever you add a new SSM workflow or move code to a new account or region.
Should every parameter be a SecureString?
No, only sensitive values. Non-sensitive config as plain String avoids unnecessary KMS calls and permission scoping for data that was never secret.
Why did my Run Command silently fail on one instance?
The instance is very likely not a managed instance - check DescribeInstanceInformation for its PingStatus before assuming the command itself is broken.
What is the safest way to target a large, changing fleet?
Tag consistently, then target Run Command and other operations with Targets/tag:Key instead of a hardcoded instance list that needs constant updating.
Why pin an Automation document version?
So a later UpdateDocument that changes the default version does not silently alter the behavior of runbooks you already depend on in production.
Is Session Manager auditable by default?
Session start and end are always recorded in CloudTrail. Full command transcripts require explicitly enabling CloudWatch Logs or S3 logging in Session Manager preferences.
When should I use Advanced-tier parameters?
Only when you need more than 4 KB, more than the account's Standard-tier limit, or a parameter policy like Expiration - Advanced bills per parameter per month.
How do I avoid a Run Command rollout taking down the whole fleet?
Set MaxErrors to a conservative threshold and MaxConcurrency to stagger execution, so a bad command is caught after a handful of instances, not all of them.
Should Automation's execution role be broad?
No, scope it to exactly what the runbook's steps need. Automation can reach any AWS API permitted by its role, so an over-broad role is a real risk, not just an EC2-adjacent one.
Do I need to write my own retry logic for SSM calls?
Usually no. Both SDKs retry throttling and transient errors with backoff by default; adjust retry configuration rather than reimplementing it.
What is the biggest hidden cost in Systems Manager usage?
Converting a large parameter tree wholesale to Advanced tier when only a few actually need it, and Automation steps that fan out into other billed services (Lambda, other API calls) without that cost being obvious upfront.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).