1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

declare -A prod
declare -A stage

prod+=(
    "datadog_api_key:<removed>"
    "gremlin_secret_uuid:<removed>"
    "newrelic_license_key:<removed>"
    "sumo_access_id:<removed>"
    "sumo_access_key:<removed>"
    "threatstack_key:<removed>"
)

stage+=(
    "datadog_api_key:<removed>"
    "gremlin_secret_uuid:<removed>"
    "newrelic_license_key:<removed>"
    "sumo_access_id:<removed>"
    "sumo_access_key:<removed>"
    "threatstack_key:<removed>"
)

for item in ${stage[@]}; do
    key="${item%%:*}"
    value="${item##*:}"
    echo aws ssm put-parameter --name "stage.ec2-instances.${key}.v1" --value "${value}" --type SecureString --key-id alias/stage-key
    aws ssm put-parameter --name "stage.ec2-instances.${key}.v1" --value "${value}" --type SecureString --key-id alias/stage-key
    echo ""
done

for item in ${prod[@]}; do
    key="${item%%:*}"
    value="${item##*:}"
    echo aws ssm put-parameter --name "prod.ec2-instances.${key}.v1" --value "${value}" --type SecureString --key-id alias/prod-key
    aws ssm put-parameter --name "prod.ec2-instances.${key}.v1" --value "${value}" --type SecureString --key-id alias/prod-key
    echo ""
done