CreateJob
Creates a job.
Requires permission to access the CreateJob action.
Request Syntax
PUT /jobs/jobId
HTTP/1.1
Content-type: application/json
{
"abortConfig": {
"criteriaList": [
{
"action": "string
",
"failureType": "string
",
"minNumberOfExecutedThings": number
,
"thresholdPercentage": number
}
]
},
"description": "string
",
"destinationPackageVersions": [ "string
" ],
"document": "string
",
"documentParameters": {
"string
" : "string
"
},
"documentSource": "string
",
"jobExecutionsRetryConfig": {
"criteriaList": [
{
"failureType": "string
",
"numberOfRetries": number
}
]
},
"jobExecutionsRolloutConfig": {
"exponentialRate": {
"baseRatePerMinute": number
,
"incrementFactor": number
,
"rateIncreaseCriteria": {
"numberOfNotifiedThings": number
,
"numberOfSucceededThings": number
}
},
"maximumPerMinute": number
},
"jobTemplateArn": "string
",
"namespaceId": "string
",
"presignedUrlConfig": {
"expiresInSec": number
,
"roleArn": "string
"
},
"schedulingConfig": {
"endBehavior": "string
",
"endTime": "string
",
"maintenanceWindows": [
{
"durationInMinutes": number
,
"startTime": "string
"
}
],
"startTime": "string
"
},
"tags": [
{
"Key": "string
",
"Value": "string
"
}
],
"targets": [ "string
" ],
"targetSelection": "string
",
"timeoutConfig": {
"inProgressTimeoutInMinutes": number
}
}
URI Request Parameters
The request uses the following URI parameters.
- jobId
-
A job identifier which must be unique for your AWS account. We recommend using a UUID. Alpha-numeric characters, "-" and "_" are valid for use here.
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Required: Yes
Request Body
The request accepts the following data in JSON format.
- abortConfig
-
Allows you to create the criteria to abort a job.
Type: AbortConfig object
Required: No
- description
-
A short text description of the job.
Type: String
Length Constraints: Maximum length of 2028.
Pattern:
[^\p{C}]+
Required: No
- destinationPackageVersions
-
The package version Amazon Resource Names (ARNs) that are installed on the device when the job successfully completes. The package version must be in either the Published or Deprecated state when the job deploys. For more information, see Package version lifecycle.
Note:The following Length Constraints relates to a single ARN. Up to 25 package version ARNs are allowed.
Type: Array of strings
Length Constraints: Minimum length of 1. Maximum length of 1600.
Pattern:
^arn:[!-~]+$
Required: No
- document
-
The job document. Required if you don't specify a value for
documentSource
.Type: String
Length Constraints: Maximum length of 32768.
Required: No
- documentParameters
-
Parameters of an AWS managed template that you can specify to create the job document.
Note
documentParameters
can only be used when creating jobs from AWS managed templates. This parameter can't be used with custom job templates or to create jobs from them.Type: String to string map
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Key Pattern:
[a-zA-Z0-9_-]+
Value Length Constraints: Minimum length of 1. Maximum length of 512.
Value Pattern:
[^\p{C}]+
Required: No
- documentSource
-
An S3 link, or S3 object URL, to the job document. The link is an Amazon S3 object URL and is required if you don't specify a value for
document
.For example,
--document-source https://s3.region-code.amazonaws.com/example-firmware/device-firmware.1.0
For more information, see Methods for accessing a bucket.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1350.
Required: No
- jobExecutionsRetryConfig
-
Allows you to create the criteria to retry a job.
Type: JobExecutionsRetryConfig object
Required: No
- jobExecutionsRolloutConfig
-
Allows you to create a staged rollout of the job.
Type: JobExecutionsRolloutConfig object
Required: No
- jobTemplateArn
-
The ARN of the job template used to create the job.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1600.
Pattern:
^arn:[!-~]+$
Required: No
- namespaceId
-
The namespace used to indicate that a job is a customer-managed job.
When you specify a value for this parameter, AWS IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.
$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/
Note
The
namespaceId
feature is only supported by AWS IoT Greengrass at this time. For more information, see Setting up AWS IoT Greengrass core devices.Type: String
Pattern:
[a-zA-Z0-9_-]+
Required: No
- presignedUrlConfig
-
Configuration information for pre-signed S3 URLs.
Type: PresignedUrlConfig object
Required: No
- schedulingConfig
-
The configuration that allows you to schedule a job for a future date and time in addition to specifying the end behavior for each job execution.
Type: SchedulingConfig object
Required: No
-
Metadata which can be used to manage the job.
Type: Array of Tag objects
Required: No
- targets
-
A list of things and thing groups to which the job should be sent.
Type: Array of strings
Array Members: Minimum number of 1 item.
Length Constraints: Maximum length of 2048.
Required: Yes
- targetSelection
-
Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group.
Note
We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.
Type: String
Valid Values:
CONTINUOUS | SNAPSHOT
Required: No
- timeoutConfig
-
Specifies the amount of time each device has to finish its execution of the job. The timer is started when the job execution status is set to
IN_PROGRESS
. If the job execution status is not set to another terminal state before the time expires, it will be automatically set toTIMED_OUT
.Type: TimeoutConfig object
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"description": "string",
"jobArn": "string",
"jobId": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- description
-
The job description.
Type: String
Length Constraints: Maximum length of 2028.
Pattern:
[^\p{C}]+
- jobArn
-
The job ARN.
Type: String
- jobId
-
The unique identifier you assigned to this job.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Errors
- InvalidRequestException
-
The request is not valid.
HTTP Status Code: 400
- LimitExceededException
-
A limit has been exceeded.
HTTP Status Code: 410
- ResourceAlreadyExistsException
-
The resource already exists.
HTTP Status Code: 409
- ResourceNotFoundException
-
The specified resource does not exist.
HTTP Status Code: 404
- ServiceUnavailableException
-
The service is temporarily unavailable.
HTTP Status Code: 503
- ThrottlingException
-
The rate exceeds the limit.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: