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 Are Strings

One important thing to understand about the SSM Parameter Store is that everything is stored as a string.

When you save api.example.com for the host name, SSM stores it as a string. When you set true as a dev tools flag, SSM stores it as the string "true", not a boolean. In this sense, SSM parameters are a lot like environment variables.

  • Integer (5) → stored as string "5" → your app must parse it
  • Boolean (true) → stored as string "true" → your app must compare it
  • Float (3.14) → stored as string "3.14" → your app must parse it
  • Enum (red) → stored as string "red" → your app must compare it
  • JSON ({"key": "value"}) → stored as string "{\"key\": \"value\"}" → your app must parse it

Cost check: Standard SSM parameters are free (up to 10,000). This lesson is conceptual; no new parameters required.

Type Casting

When you retrieve a parameter from SSM, you get a string. Your application must then cast the value to the type you need. For example, if you're using Python:

import boto3

# get the parameter from SSM and store the string in secret_str
secret_str = ssm_get_parameter("/SECRETS")

# if the value is supposed to represent an integer, convert it
raw_port_number = ssm_get_parameter("/PORT_NUMBER")
try:
    port = int(raw_port_number)
    print(f"port number is {port}")
except ValueError:
    raise ValueError("raw_port_number turned out not to be a number")