Skip to content

Instantly share code, notes, and snippets.

@xbalajipge
Last active October 18, 2022 00:22
Show Gist options
  • Select an option

  • Save xbalajipge/7dedd834dfa175af87dbc9d897e90c3f to your computer and use it in GitHub Desktop.

Select an option

Save xbalajipge/7dedd834dfa175af87dbc9d897e90c3f to your computer and use it in GitHub Desktop.
oneliners-aws-ssm-parameter-store.sh
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 parameters drilling down
aws ssm get-parameters-by-path --recursive --path "/" | jq -c '.Parameters[] | {Param: .Name, Value: .Value}'
# display all non-us regions
aws ec2 describe-regions | jq -r '.Regions[] | select(.RegionName | test("^(?!(us-).*)")) | .RegionName'
# display all resources in non-us regions
aws ec2 describe-regions | jq -r '.Regions[] | select(.RegionName | test("^(?!(us-).*)")) | .RegionName' | xargs -t -L 1 -I {} aws resourcegroupstaggingapi get-resources --region {} | jq -r '.ResourceTagMappingList[].ResourceARN'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment