aws-cli
aws-cli copied to clipboard
`aws iot list-jobs` doesn't return `SCHEDULED` jobs when passing `--thing-group-name`
Describe the bug
When running aws iot list-jobs
, all jobs are listed.
When targeting a specific thing group, by passing the parameter --thing-group-name
, scheduled jobs are NOT listed.
Expected Behavior
I expect the aws iot list-jobs --thing-group-name THINGGROUP
to include ALL jobs targeted at the specified Thing group.
Current Behavior
Currently it seems like only active (as in currently running/IN_PROGRESS) jobs are returned when specifying --thing-group-name
Reproduction Steps
I've created a Thing Group THINGGROUP
and created two jobs targeted at that group:
A continuous scheduled job, and a snapshot job.
❯ aws iot list-jobs | grep THINGGROUP
"jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
"jobId": "THINGGROUP-testing-hotfix",
"jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-scheduled",
"jobId": "THINGGROUP-testing-scheduled",
❯ aws iot list-jobs --thing-group-name THINGGROUP
{
"jobs": [
{
"jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
"jobId": "THINGGROUP-testing-hotfix",
"thingGroupId": "8f7f92c6-46c0-46ef-b7d8-282f4a18d0d6",
"targetSelection": "SNAPSHOT",
"status": "IN_PROGRESS",
"createdAt": "2024-09-16T17:38:06.627000+02:00",
"lastUpdatedAt": "2024-09-16T17:38:12.756000+02:00",
"isConcurrent": false
}
]
}
❯ aws iot describe-job --job-id THINGGROUP-testing-scheduled
{
"job": {
"jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-scheduled",
"jobId": "THINGGROUP-testing-scheduled",
"targetSelection": "CONTINUOUS",
"status": "SCHEDULED",
"targets": [
"arn:aws:iot:AWS_REGION:098765432123:thinggroup/THINGGROUP"
],
"description": "A managed job template for rebooting the device.",
"presignedUrlConfig": {},
"jobExecutionsRolloutConfig": {
"maximumPerMinute": 1000
},
"createdAt": "2024-09-16T17:36:41.141000+02:00",
"lastUpdatedAt": "2024-09-16T17:36:41.141000+02:00",
"jobProcessDetails": {
"numberOfCanceledThings": 0,
"numberOfSucceededThings": 0,
"numberOfFailedThings": 0,
"numberOfRejectedThings": 0,
"numberOfQueuedThings": 0,
"numberOfInProgressThings": 0,
"numberOfRemovedThings": 0,
"numberOfTimedOutThings": 0
},
"timeoutConfig": {},
"jobTemplateArn": "arn:aws:iot:AWS_REGION::jobtemplate/AWS-Reboot:1.0",
"documentParameters": {
"pathToHandler": "default",
"runAsUser": "root"
},
"schedulingConfig": {
"startTime": "2024-09-17T22:00",
"maintenanceWindows": [
{
"startTime": "cron(0 2 ? * WED *)",
"durationInMinutes": 120
}
]
},
"scheduledJobRollouts": [
{
"startTime": "2024-09-18T02:00"
},
{
"startTime": "2024-09-25T02:00"
},
{
"startTime": "2024-10-02T02:00"
},
{
"startTime": "2024-10-09T02:00"
},
{
"startTime": "2024-10-16T02:00"
},
{
"startTime": "2024-10-23T02:00"
},
{
"startTime": "2024-10-30T02:00"
}
]
}
}
❯ aws iot describe-job --job-id THINGGROUP-testing-hotfix
{
"job": {
"jobArn": "arn:aws:iot:AWS_REGION:098765432123:job/THINGGROUP-testing-hotfix",
"jobId": "THINGGROUP-testing-hotfix",
"targetSelection": "SNAPSHOT",
"status": "IN_PROGRESS",
"targets": [
"arn:aws:iot:AWS_REGION:098765432123:thinggroup/THINGGROUP"
],
"description": "A managed job template for rebooting the device.",
"presignedUrlConfig": {},
"jobExecutionsRolloutConfig": {
"maximumPerMinute": 1000
},
"createdAt": "2024-09-16T17:38:06.627000+02:00",
"lastUpdatedAt": "2024-09-16T17:38:12.756000+02:00",
"jobProcessDetails": {
"numberOfCanceledThings": 0,
"numberOfSucceededThings": 0,
"numberOfFailedThings": 0,
"numberOfRejectedThings": 0,
"numberOfQueuedThings": 1,
"numberOfInProgressThings": 0,
"numberOfRemovedThings": 0,
"numberOfTimedOutThings": 0
},
"timeoutConfig": {},
"jobTemplateArn": "arn:aws:iot:AWS_REGION::jobtemplate/AWS-Reboot:1.0",
"documentParameters": {
"pathToHandler": "default",
"runAsUser": "root"
},
"isConcurrent": false,
"schedulingConfig": {}
}
}
Possible Solution
No response
Additional Information/Context
Using Boto3 gives the same results when passing a Thing group name. So it might be an API issue and not specifically an AWS CLI issue.
CLI version used
aws-cli/2.17.51 Python/3.11.9 Darwin/23.6.0 exe/x86_64
Environment details (OS name and version, etc.)
Darwin laptop 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64