

# Examples with curl for the Parameter Store extension in AWS Systems Manager Cloud Extensions

Use curl to read parameters through the Parameter Store extension on localhost. These examples read the parameters `/my-app/db-host` and `/my-app/api-url`, which are `String` parameters, and `/my-app/db-password`, which is a `SecureString` parameter. Replace them with the names of your own parameters, and run the examples while the runtime serves the extension.

curl signs the request with the `--aws-sigv4` option. Use the extension key of the profile as the credentials, and set the headers and the JSON body of the operation yourself:

```bash
E=http://localhost:5333/parameterstore
K="{{extension-access-key-id}}:{{extension-secret-key}}"
```

**Get one parameter (GetParameter)**

```bash
curl -s "$E" --aws-sigv4 "aws:amz:us-west-2:ssm" --user "$K" \
  -H "X-Amz-Target: AmazonSSM.GetParameter" \
  -H "Content-Type: application/x-amz-json-1.1" \
  -d '{"Name": "/my-app/db-host"}' | jq
```

**Get several parameters (GetParameters)**

```bash
curl -s "$E" --aws-sigv4 "aws:amz:us-west-2:ssm" --user "$K" \
  -H "X-Amz-Target: AmazonSSM.GetParameters" \
  -H "Content-Type: application/x-amz-json-1.1" \
  -d '{"Names": ["/my-app/db-host", "/my-app/api-url"]}' | jq
```

**Read a SecureString decrypted**

```bash
curl -s "$E" --aws-sigv4 "aws:amz:us-west-2:ssm" --user "$K" \
  -H "X-Amz-Target: AmazonSSM.GetParameter" \
  -H "Content-Type: application/x-amz-json-1.1" \
  -d '{"Name": "/my-app/db-password", "WithDecryption": true}' | jq
```

Without `"WithDecryption": true`, the extension returns the encrypted value of a SecureString.

**Read a version**

```bash
curl -s "$E" --aws-sigv4 "aws:amz:us-west-2:ssm" --user "$K" \
  -H "X-Amz-Target: AmazonSSM.GetParameter" \
  -H "Content-Type: application/x-amz-json-1.1" \
  -d '{"Name": "/my-app/db-host:1"}' | jq
```

The response includes `"Selector": ":1"`.

The extension caches errors for **Cache TTL** seconds. If you read a parameter before you create it, the extension returns `ParameterNotFound` until the time to live (TTL) expires.