Reputation: 803
AWS CLI describe-parameters retrieves all ssm parameter data but the description value.
I am trying to fetch all the ssm parameters from an AWS account, to migrate them to another AWS account.
To find out the issue, I have tried running the following command to retrieve just one parameter. It prints out everything but the Description value
aws ssm describe-parameters --filters Key=Name,Values=<your-parameter-name>
I have also tried the following command to retrieve all the parameters. Again, they return everything but the Description value
aws ssm get-parameters-by-path --path "/" --recursive --region <region> --output text --query 'Parameters[].{Name:Name,Value:Value,Description:Description}'
The above command returns the Name and the Value, but prints out null
for the description. I also tried not including the query
cli option to see what the command prints out. Command below:
aws ssm get-parameters-by-path --path "/" --recursive --region <region>
It prints out everything except the Description
. Which confirmed that AWS is not reading the Description
value.
Is there a way to also retrieve the Description
? Because it would be time consuming to migrate all the parameters, but the Description and then manually copy over the description.
I am using a shell script to get all the parameters and then upload them along with the description values. But the focus of this question to find a way to get the Description
.
Upvotes: 0
Views: 803
Reputation: 1937
I faced a similar issue recently where I needed to download SSM parameters and import them into my terraform state, and I also realized the descriptions were not included.
To retrieve SSM parameter details, including descriptions, I combined aws ssm describe-parameters to list parameters and aws ssm get-parameter to get details for each parameter.
Here’s an approach using a shell script:
#!/bin/bash
# Replace <region> with your AWS region
region="<region>"
# Get a list of all parameter names
parameter_names=$(aws ssm describe-parameters --region $region --query "Parameters[].Name" --output text)
# Loop through each parameter name to fetch its details, including the description
for name in $parameter_names; do
echo "Details for parameter: $name"
aws ssm get-parameter --name "$name" --region $region --with-decryption --query "Parameter.{Name:Name,Value:Value,Description:Description}" --output text
done
Hope this works for you.
Upvotes: 1