We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

SSM Parameters

A ubiquitous problem with running applications in production is configuring servers and applications. For example:

  • Should the app run in debug mode?
  • What domain name should it expect?
  • Where should it send logs?

On our own machines, we often use environment variables: key-value pairs that are available to everything running in the local environment (e.g. EDITOR=nvim). In Kubernetes, we use ConfigMaps or Secrets to store configuration values.

AWS provides a vendor-specific solution in AWS Systems Manager Parameter Store (SSM parameters). It's a centralized safe where you can keep configuration data, secrets, and parameters that your applications need. It provides:

  • Key-value storage: Store configuration values, secrets, and parameters
  • Organization by path: Use hierarchical paths like /DB_ENDPOINT or /SECRETS
  • Security: Can encrypt sensitive values (SecureString type)
  • Accessibility: Applications and EC2 instances can retrieve parameters via IAM permissions
  • Versioning: Track changes to parameter values over time

I often encounter applications where part of the config is "computed" at startup or during deployment (stuff you can't know ahead of time, or that depends on the environment). SSM parameters make it easy to adjust those magic values in a central place, and let your application pull its exact configuration whenever it needs.

Assignment

Setting a DATABASE_URL env var got the Pinger server up and running, but PatientPing wants to do things right and start saving app config in SSM parameters.

Create parameters /DATABASE_URL (an RDS instance connection URL) and /CMO_NAME (a value your app will use) in Parameter Store.

Cost check: Standard SSM parameters are free for up to 10,000 parameters. Advanced parameters (with encryption) cost $0.05 per parameter per month.

You should now see DATABASE_URL and CMO_NAME in the "My parameters" list.

Run and submit the CLI tests.

Tip

You can also create SSM parameters via the AWS CLI:

aws ssm put-parameter --name /DATABASE_URL --value postgresql://postgres:[email protected]:5432/patientping --type String
aws ssm put-parameter --name /CMO_NAME --value 'Dr. Strangelove' --type String