title: CloudFormation - Install and configure CloudWatch Agent to EC2 Instances
body: <p>I have a CloudFormation template that create ec2 instances using LaunchTemplate, but I want to add cloudwatch agent to the instances, but I can't figure what's wrong.</p>
  <p>I have 2 configSets, but the cfn-init get stuck in <strong>&quot;02_download_app&quot;</strong> &gt; <strong>&quot;Command run_app&quot;</strong>, this part I run a jar file from /.</p>
  <p>Here is the output from <code>/var/log/cfn-init-cmd.log</code>, I noticed that after the command run_app the jar get stucked <code>17:25</code>, and some time later <code>17:42</code> I connect to the instance kill the jar and relaunch and it continues the script successfully, I think the error is some encoding problem, but I don't know where: in the jar? in log4j config file?, etc.</p>
  <pre><code>2020-06-23 17:25:20,679 main ERROR Console contains an invalid element or attribute &quot;Encoding&quot;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Y4qB8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y4qB8.jpg" alt="cfn-init-cmd.log" /></a></p>
  <pre><code>    configSets:
        setup:
          - &quot;01_install_java&quot;
          - &quot;02_download_app&quot;
          - &quot;03_setupCfnHup&quot;
          - &quot;04_config-amazon-cloudwatch-agent&quot;
          - &quot;05_restart_amazon-cloudwatch-agent&quot;
        updateEnvironment:
          - &quot;04_config-amazon-cloudwatch-agent&quot;
          - &quot;05_restart_amazon-cloudwatch-agent&quot;
  </code></pre>
  <p>I followed this <a href="https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/solutions/AmazonCloudWatchAgent/inline/ubuntu.template" rel="nofollow noreferrer">template</a>, here is part of my template and the cfn-init part.</p>
  <pre><code>AWSTemplateFormatVersion: 2010-09-09
  Description: &gt;-
    Cloudformation template.
  
  Metadata:
    Stack:
      Value: 2
    VersionDate:
      Value: 30032020
    Identifier:
      Value: template-app-stack
    Input:
      Description: EC2 Instance Types, DB Instance Type and Engine
    Output:
      Description: Outputs ID of all deployed resources
  
    AWS::CloudFormation::Interface:
      Parameters:
      #....... other omitted .......#
      #....... other omitted .......#
    Resources:
    #....... other omitted .......#
    #backend autoscaling#
      rBackendFleet:
        Type: AWS::AutoScaling::AutoScalingGroup
        Condition: cIsProduction
        Properties:
          AutoScalingGroupName: !Join [ '-', [!Ref pApplicationName, 'asg', !Ref pApplicationEnvironment, 'backend'] ]
          VPCZoneIdentifier: !Ref pBackendSubnets
          MinSize: 1
          MaxSize: 10
          MetricsCollection:
            - Granularity: 1Minute
          DesiredCapacity: 1
          HealthCheckGracePeriod: 300
          TargetGroupARNs:
            - !Ref rPrivateLoadBalancerTargetGroup
          LaunchTemplate: 
            LaunchTemplateId: !Ref rBackendLaunchTemplate
            Version: !GetAtt rBackendLaunchTemplate.LatestVersionNumber
      rBackendLaunchTemplate:
        Type: AWS::EC2::LaunchTemplate
        Metadata:
          AWS::CloudFormation::Init:
            configSets:
              setup:
                - &quot;01_install_java&quot;
                - &quot;02_download_app&quot;
                - &quot;03_setupCfnHup&quot;
                - &quot;04_config-amazon-cloudwatch-agent&quot;
                - &quot;05_restart_amazon-cloudwatch-agent&quot;
              updateEnvironment:
                - &quot;04_config-amazon-cloudwatch-agent&quot;
                - &quot;05_restart_amazon-cloudwatch-agent&quot;
            01_install_java:
              packages:
                apt:
                  unzip: []
                  openjdk-8-jre-headless: []
            02_download_app:
              files:
                /tmp/backend.zip:
                  source: !Sub
                    - &gt;-
                      https://${bucketName}.s3-${region}.amazonaws.com/${objectKey}
                    - bucketName: !Ref pSourceCodeBucketName
                      objectKey: !Ref pBackendArtifactObjectKey
                      region: !Ref AWS::Region
                  mode: &quot;000644&quot;
                  owner: &quot;root&quot;
                  group: &quot;root&quot;
                  authentication: rolebased
              commands:
                configure_app:
                  command: &quot;sudo unzip backend.zip&quot;
                  test: &quot;sudo ls -la&quot;
                  cwd: &quot;/tmp&quot;
                run_app:
                  command: &quot;sudo java -jar /tmp/app.jar &amp;&quot;
                  test: &quot;sudo ps -ef | grep java&quot;
                  cwd: &quot;/&quot;
            04_config-amazon-cloudwatch-agent:
              files:
                /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json:
                  content: !Sub |
                    {
                      &quot;metrics&quot;: {
                        &quot;append_dimensions&quot;: {
                          &quot;AutoScalingGroupName&quot;: &quot;${!aws:AutoScalingGroupName}&quot;,
                          &quot;ImageId&quot;: &quot;${!aws:ImageId}&quot;,
                          &quot;InstanceId&quot;: &quot;${!aws:InstanceId}&quot;,
                          &quot;InstanceType&quot;: &quot;${!aws:InstanceType}&quot;
                        },
                        &quot;aggregation_dimensions&quot;:
                          [[&quot;AutoScalingGroupName&quot;], [&quot;InstanceId&quot;, &quot;InstanceType&quot;],[]]
                        ,
                        &quot;metrics_collected&quot;: {
                          &quot;mem&quot;: {
                            &quot;measurement&quot;: [
                              &quot;mem_used_percent&quot;
                            ]
                          },
                          &quot;swap&quot;: {
                            &quot;measurement&quot;: [
                              &quot;swap_used_percent&quot;
                            ]
                          }
                        }
                      },
                      &quot;logs&quot;: {
                        &quot;logs_collected&quot;: {
                          &quot;files&quot;: {
                            &quot;collect_list&quot;: [
                              {
                                &quot;file_path&quot;: &quot;/profuturo/app/profuturo-rest-comunicaciones/logs/profuturo-rest-comunicaciones.log&quot;,
                                &quot;log_group_name&quot;: &quot;/var/log/${pApplicationName}-${pApplicationEnvironment}&quot;,
                                &quot;log_stream_name&quot;: &quot;{instance_id}&quot;,
                                &quot;timestamp_format&quot;: &quot;%Y-%m-%d %H:%M:%S,%f&quot;,
                                &quot;multi_line_start_pattern&quot;: &quot;{timestamp_format}&quot;
                              }
                            ]
                          }
                        }
                      }
                    }
            05_restart_amazon-cloudwatch-agent:
              commands:
                01_stop_service:
                  command: &quot;/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a stop&quot;
                02_start_service:
                  command: &quot;/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json -s&quot;
            03_setupCfnHup:
              files:
                /etc/cfn/cfn-hup.conf:
                  content: !Sub |
                    [main]
                    stack=${AWS::StackName}
                    region=${AWS::Region}
                    verbose=true
                    interval=1
                  mode: &quot;000400&quot;
                  owner: &quot;root&quot;
                  group: &quot;root&quot;
                /etc/cfn/hooks.d/amazon-cloudwatch-agent-auto-reloader.conf:
                  content: !Sub |
                    [cfn-auto-reloader-hook]
                    triggers=post.update
                    path=Resources.rBackendLaunchTemplate.Metadata.AWS::CloudFormation::Init.04_config-amazon-cloudwatch-agent
                    action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource rBackendLaunchTemplate --configsets updateEnvironment --region ${AWS::Region}
                    runas=root
                  mode: &quot;000400&quot;
                  owner: &quot;root&quot;
                  group: &quot;root&quot;
                /lib/systemd/system/cfn-hup.service:
                  content: !Sub |
                    [Unit]
                    Description=cfn-hup daemon
                    [Service]
                    Type=simple
                    ExecStart=/opt/aws/bin/cfn-hup
                    Restart=always
                    [Install]
                    WantedBy=multi-user.target
                  mode: &quot;000400&quot;
                  owner: &quot;root&quot;
                  group: &quot;root&quot;
              commands:
                01enable_cfn_hup:
                  command: &quot;systemctl enable cfn-hup.service&quot;
                02start_cfn_hup:
                  command: &quot;systemctl start cfn-hup.service&quot;
          AWS::CloudFormation::Authentication: 
            rolebased: 
              type: S3
              buckets: 
                - !Sub ${pSourceCodeBucketName}
              roleName: 
                Ref: pInstanceRole
        Properties: 
          LaunchTemplateName: !Join [ '-', [!Ref pApplicationName, 'lt', !Ref pApplicationEnvironment, 'backend'] ]
          LaunchTemplateData:
            BlockDeviceMappings:
              - Ebs:
                  VolumeSize: 10
                  VolumeType: gp2
                DeviceName: /dev/sda1
            SecurityGroupIds: 
              - !Ref rBackendSecurityGroup
            EbsOptimized: false
            IamInstanceProfile:
              Arn: !GetAtt rRootInstanceProfile.Arn
            ImageId: !Ref pBackendAMI
            InstanceType: !Ref pBackendInstanceType
            KeyName: !Ref pKeyName
            Monitoring:
              Enabled: true
            UserData: 
              Fn::Base64: !Sub |
                #!/bin/bash -xe
                sudo apt-get update -y
                sudo apt-get install -y python
                sudo apt-get install -y python-setuptools
                sudo apt-get  install -y python-pip
                wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -O /tmp/amazon-cloudwatch-agent.deb
                dpkg -i /tmp/amazon-cloudwatch-agent.deb
                sudo mkdir -p /opt/aws/bin
                sudo python /usr/lib/python2.7/dist-packages/easy_install.py --script-dir /opt/aws/bin https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
                sudo /opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource rBackendLaunchTemplate --configsets setup,updateEnvironment --region ${AWS::Region}
                sudo /opt/aws/bin/cfn-signal -e $? -r &quot;Backend setup done.&quot; --stack ${AWS::StackName} --resource rBackendLaunchTemplate --region ${AWS::Region}
      ........
      #App Tier Autoscaling#
      #....... other omitted .......#
  </code></pre>
  <p>I watched /var/log/cloud-init-output.log, but no clue of the error, says that is some encoding problem but in what step?</p>
  <pre><code>+ sudo /opt/aws/bin/cfn-init -v --stack cwp-prod --resource rBackendLaunchTemplate --configsets setup,updateEnvironment --region us-west-2
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13224: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13233: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 309: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 207: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 180: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 114: ordinal not in range(128)
  Logged from file util.py, line 503
  Traceback (most recent call last):
    File &quot;/usr/lib/python2.7/logging/__init__.py&quot;, line 891, in emit
      stream.write(fs % msg.encode(&quot;UTF-8&quot;))
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 130: ordinal not in range(128)
  Logged from file util.py, line 503
  + sudo /opt/aws/bin/cfn-signal -e 0 -r 'Backend setup done.' --stack cwp-prod --resource rBackendLaunchTemplate --region us-west-2
  ValidationError: Stack arn:aws:cloudformation:us-west-2:496852590701:stack/cwp-prod/80743380-b533-11ea-9ea4-02e40fd26800 is in CREATE_COMPLETE state and cannot be signaled
  Cloud-init v. 19.3-41-gc4735dd3-0ubuntu1~18.04.1 running 'modules:final' at Tue, 23 Jun 2020 20:31:35 +0000. Up 23.76 seconds.
  2020-06-23 21:31:14,217 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
  2020-06-23 21:31:14,223 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
  2020-06-23 21:31:14,226 - util.py[WARNING]: Running module scripts-user (&lt;module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'&gt;) failed
  Cloud-init v. 19.3-41-gc4735dd3-0ubuntu1~18.04.1 finished at Tue, 23 Jun 2020 21:31:14 +0000. Datasource DataSourceEc2Local.  Up 3602.81 seconds
  </code></pre>