@@ -6,16 +6,16 @@ echo "Retrieving TOKEN from AWS API"
6
6
token=$( curl -f -X PUT " http://169.254.169.254/latest/api/token" -H " X-aws-ec2-metadata-token-ttl-seconds: 180" )
7
7
8
8
region=$( curl -f -H " X-aws-ec2-metadata-token: $token " -v http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)
9
- echo " Reteieved REGION from AWS API ($region )"
9
+ echo " Retrieved REGION from AWS API ($region )"
10
10
11
11
instance_id=$( curl -f -H " X-aws-ec2-metadata-token: $token " -v http://169.254.169.254/latest/meta-data/instance-id)
12
- echo " Reteieved INSTANCE_ID from AWS API ($instance_id )"
12
+ echo " Retrieved INSTANCE_ID from AWS API ($instance_id )"
13
13
14
14
tags=$( aws ec2 describe-tags --region " $region " --filters " Name=resource-id,Values=$instance_id " )
15
15
echo " Retrieved tags from AWS API ($tags )"
16
16
17
17
environment=$( echo " $tags " | jq -r ' .Tags[] | select(.Key == "ghr:environment") | .Value' )
18
- echo " Reteieved ghr:environment tag - ($environment )"
18
+ echo " Retrieved ghr:environment tag - ($environment )"
19
19
20
20
parameters=$( aws ssm get-parameters-by-path --path " /$environment /runner" --region " $region " --query " Parameters[*].{Name:Name,Value:Value}" )
21
21
echo " Retrieved parameters from AWS SSM ($parameters )"
@@ -29,7 +29,7 @@ echo "Retrieved /$environment/runner/enable-cloudwatch parameter - ($enable_clou
29
29
agent_mode=$( echo " $parameters " | jq --arg environment " $environment " -r ' .[] | select(.Name == "/\($environment)/runner/agent-mode") | .Value' )
30
30
echo " Retrieved /$environment /runner/agent-mode parameter - ($agent_mode )"
31
31
32
- if [[ -n " $enable_cloudwatch_agent " ]]; then
32
+ if [[ " $enable_cloudwatch_agent " == " true " ]]; then
33
33
echo " Cloudwatch is enabled"
34
34
amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c " ssm:$environment -cloudwatch_agent_config_runner"
35
35
fi
0 commit comments