aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.06k stars 324 forks source link

EC2 - Association-Notification-Events for AWS-GatherSoftwareInventory shows StuckAtInProgress/Failed status, but Console reports Success (which is correct) #584

Open rgoltz opened 2 months ago

rgoltz commented 2 months ago

Describe the Setup & the Bug

Current Behavior

<snip>
    "eventTime": "2024-08-23T15:23:17Z",
    "eventSource": "ssm.amazonaws.com",
    "eventName": "UpdateInstanceAssociationStatus",
    "awsRegion": "eu-central-1",
    "sourceIPAddress": "1.2.3.4",
    "userAgent": "aws-sdk-go/1.51.20 (go1.21.11; windows; amd64) amazon-ssm-agent/",
    "requestParameters": {
        "associationId": "cdf20e5a-1234-abcd-4321-11223344rogo",
        "instanceId": "i-abcd1234abcd1234",
        "executionResult": {
            "executionDate": "Aug 23, 2024, 3:23:17 PM",
            "status": "Failed",
            "executionSummary": "Association stuck at InProgress for longer than 2 hours",
            "errorCode": "StuckAtInProgress"
        }
    },
    "responseElements": null,
    "requestID": "1...",
    "eventID": "2...",
    "readOnly": false,
    "resources": [
        {
            "accountId": "1234567890",
            "ARN": "arn:aws:ssm:eu-central-1:1234567890:association/cdf20e5a-1234-abcd-4321-11223344rogo"
        },
        {
            "accountId": "1234567890",
            "ARN": "arn:aws:ec2:eu-central-1:1234567890:instance/i-abcd1234abcd1234"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
<snip>

Checking the local errors.log of SSM Agent at the same time of the event, we see: (Windows - Server 2016 Datacenter Build 14393, SSM Agent Version: 3.3.551.0)

2024-08-23 17:23:17 ERROR [runScheduledAssociation @ processor.go.305] [ssm-agent-worker] [MessageService] [Association] Association stuck at InProgress for longer than 2 Hours

(Linux - Amazon Linux 2, SSM Agent Version: 3.3.380.0)

2024-08-22 04:57:28 ERROR [runScheduledAssociation @ processor.go.313] [ssm-agent-worker] [MessageService] [Association] Association stuck at InProgress for longer than 2 Hours

Expected Behavior:

Workaround: