Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Last active September 27, 2023 15:21
Show Gist options
  • Save xbalaji/5a07b5424c039c84d7036ca0f0163eda to your computer and use it in GitHub Desktop.
Save xbalaji/5a07b5424c039c84d7036ca0f0163eda to your computer and use it in GitHub Desktop.
aws ssm cli
export AWS_DEFAULT_PROFILE=""
# to display parameter store variables for aws latest linux
aws ssm get-parameters-by-path --path "/aws/service/ami-amazon-linux-latest" --region us-west-2
# get the list of parameter store variables in the account
aws ssm describe-parameters | jq '.Parameters[].Name'
# remove the last path and filter higher level path
aws ssm describe-parameters | jq '.Parameters[].Name' | sed -e 's,\(.*\)/.*,\1",g' | sort | uniq
# display certain path values
aws ssm get-parameters-by-path --path "/general"
# if you know the list of parameters, aws cli itself has a way to display just the values
aws ssm get-parameters --names "/general/environment" "/general/project" --query "Parameters[*].{Name:Name,Value:Value}"
# if you don't you can use jq
aws ssm get-parameter --name "/general/environment" | jq -c '{Param: .Parameter.Name, Value: .Parameter.Value}'
# to display every parameter with its value given a path
aws ssm get-parameters-by-path --path "/general" | jq -c '.Parameters[] | {Param: .Name, Value: .Value}'
# to display all parameters drilling down
aws ssm get-parameters-by-path --recursive --path "/vpc" | jq -c '.Parameters[] | {Param: .Name, Value: .Value}'
# to display all available parameters drilling down
aws ssm get-parameters-by-path --recursive --path "/" | jq -c '.Parameters[] | {Param: .Name, Value: .Value}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment