Skip to content

Instantly share code, notes, and snippets.

@benrowe
Created November 7, 2023 05:04
Show Gist options
  • Save benrowe/3fb242cebdd3758c454735361fdbdc37 to your computer and use it in GitHub Desktop.
Save benrowe/3fb242cebdd3758c454735361fdbdc37 to your computer and use it in GitHub Desktop.
Convert aws SSM params to .env file

Usage

./script.sh us-east-1 /my/param/prefix/ example.env

#!/usr/bin/env bash
region=$1
path=$2
output=$3
aws ssm get-parameters-by-path \
--region $region \
--path $path \
--query "Parameters[*].{Name:Name,Value:Value}" \
--with-decryption | \
jq -r ".[] | \"\(.Name|split(\"/\")|.[-1])=\(.Value)\"" | \
sort > $output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment