How To Parse JSON Parameters Stored In AWS Parameter

Hi Techies,

In the current multi-environment & microservice application deployment, the biggest challenge is where and how to put the application configuration so that you can deploy artifacts in any environment and you don’t need to change the configuration into the application.

Here I am deploying the microservice application on AWS fargate as a container. For this, I am storing all the configurations in the AWS Parameter Store.

What is AWS Parameter Store?

AWS Parameter Store, a sub-service of AWS Systems Manager. It provides hierarchical storage for configuration data management, secure, and secrets management. You can store configuration data such as database connection strings, third-party client secrets, and enterprise license codes as parameter values. In AWS Parameter Store you can store values as plain text or encrypted data which can be encrypted using AWS KMS (Key Management Service).

In this article, I will create an AWS parameter store and in this, I will store JSON configuration. And finally using the AWS CLI and JQ library I will parse JSON parameters stored into the AWS parameter store.

Let’s create an AWS SSM parameters string:

Step 1: Log in to AWS Console

Step 2: Visit AWS Systems Manager

Step 3: locate Parameter Store in Application Management

AWS Systems Manager – 1

Step 4: Create a Parameter Store with JSON value

AWS Systems Manager – 2

Read the parameter using the AWS CLI

aws ssm get-parameters --name /devops/json-configuration

you get something like this

    "Parameters": [
            "Name": "/devops/json-configuration",
            "Type": "String",
            "Value": "{\"client_id\":\"devopsdice_client_id\",\"client_secret\":\"devopsdice_secret\",\"authorize_scopes\":\"openid\"}",
            "Version": 1,
            "LastModifiedDate": "2023-02-19T19:21:18.804000+00:00",
            "ARN": "arn:aws:ssm:us-east-1:055133199710:parameter/devops/json-configuration",
            "DataType": "text"
    "InvalidParameters": []

What I wanted to get in a shell script, was the JSON representation of Value like this:

  "client_id": "devopsdice_client_id",
  "client_secret": "devopsdice_secret",
  "authorize_scopes": "openid"

Now this magic will happen with the most popular command jq

aws ssm get-parameters --name /devops/json-configuration | jq '.Parameters | .[] | .Value'

Output will be


Using this command you will get the value of the escaped quote.

Another call to jq will give us the desired result in JSON format

aws ssm get-parameters --name /devops/json-configuration | jq '.Parameters | .[] | .Value' | jq '.|fromjson'
Happy Coding!!!

Thanks for Reading!

You May Also Like