Execution Timeout for SSM Run Command

0

I have 5 EC2 instances in Fleet Manager I'm trying to set up to execute a Run Command every night to sync a large S3 bucket to a directory on the EC2s.

All 5 EC2s have SSM Agent version 3.1.1927.0, they all have the necessary IAM Role for SSM to access the EC2, and the amazon-ssm-agent is running.

My SSM Document:

{
  "schemaVersion": "2.2",
  "description": "Sync datafiles from S3",
  "parameters": {
    "executionTimeout": {
      "type": "String",
      "default": "18000",
      "description": "The time in seconds for a command to complete before it is considered to have failed"
    }
  },
  "mainSteps": [
    {
      "name": "SyncDatafiles",
      "action": "aws:runShellScript",
      "inputs": {
        "runCommand": [
          "/usr/bin/aws s3 sync s3://fsn-s3-datafolder /datafolder/ --delete --profile my_profile --region us-west-2 --cli-read-timeout 18000",
          "curl -X POST -H 'Content-type: application/json' --data \"{'text':'S3 Sync to EC2 Complete'}\" https://hooks.slack.com/services/URI/FOR/SLACK"
        ],
        "timeoutSeconds": "{{ executionTimeout }}"
      }
    }
  ]
}

I tried 9999 for the timeout. That didn't work. I tried 18000. That did not work.

On the EC2, in /var/log/amazon/ssm/amazon-ssm-agent.log I see:

2023-07-11 02:04:13 INFO [ssm-agent-worker] [MessageService] [MGSInteractor] Sending reply {
  "additionalInfo": {
    "agent": {
      "lang": "en-US",
      "name": "amazon-ssm-agent",
      "os": "",
      "osver": "1",
      "ver": ""
    },
    "dateTime": "2023-07-11T07:04:13.468Z",
    "runId": "",
    "runtimeStatusCounts": {
      "TimedOut": 1
    }

I am able to run the command manually from the EC2 (aws s3 sync) and it doesn't timeout. These are brand new instances with the same Ubuntu 22.04 AMI. How can I further troubleshoot this?

Chris
asked 10 months ago191 views
1 Answer
0

You can troubleshoot by using the following documentation: https://repost.aws/knowledge-center/systems-manager-run-command

AWS
vtjean
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions