PutComplianceItems
Registers a compliance type and other compliance details on a designated resource. This operation lets you register custom compliance details with a resource. This call overwrites existing compliance information on the resource, so you must provide a full list of compliance items each time that you send the request.
ComplianceType can be one of the following:
-
ExecutionId: The execution ID when the patch, association, or custom compliance item was applied.
-
ExecutionType: Specify patch, association, or Custom:
string
. -
ExecutionTime. The time the patch, association, or custom compliance item was applied to the managed node.
-
Id: The patch, association, or custom compliance ID.
-
Title: A title.
-
Status: The status of the compliance item. For example,
approved
for patches, orFailed
for associations. -
Severity: A patch severity. For example,
Critical
. -
DocumentName: An SSM document name. For example,
AWS-RunPatchBaseline
. -
DocumentVersion: An SSM document version number. For example, 4.
-
Classification: A patch classification. For example,
security updates
. -
PatchBaselineId: A patch baseline ID.
-
PatchSeverity: A patch severity. For example,
Critical
. -
PatchState: A patch state. For example,
InstancesWithFailedPatches
. -
PatchGroup: The name of a patch group.
-
InstalledTime: The time the association, patch, or custom compliance item was applied to the resource. Specify the time by using the following format:
yyyy-MM-dd'T'HH:mm:ss'Z'
Request Syntax
{
"ComplianceType": "string
",
"ExecutionSummary": {
"ExecutionId": "string
",
"ExecutionTime": number
,
"ExecutionType": "string
"
},
"ItemContentHash": "string
",
"Items": [
{
"Details": {
"string
" : "string
"
},
"Id": "string
",
"Severity": "string
",
"Status": "string
",
"Title": "string
"
}
],
"ResourceId": "string
",
"ResourceType": "string
",
"UploadType": "string
"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- ComplianceType
-
Specify the compliance type. For example, specify Association (for a State Manager association), Patch, or Custom:
string
.Type: String
Length Constraints: Minimum length of 1. Maximum length of 100.
Pattern:
[A-Za-z0-9_\-]\w+|Custom:[a-zA-Z0-9_\-]\w+
Required: Yes
- ExecutionSummary
-
A summary of the call execution that includes an execution ID, the type of execution (for example,
Command
), and the date/time of the execution using a datetime object that is saved in the following format:yyyy-MM-dd'T'HH:mm:ss'Z'
Type: ComplianceExecutionSummary object
Required: Yes
- ItemContentHash
-
MD5 or SHA-256 content hash. The content hash is used to determine if existing information should be overwritten or ignored. If the content hashes match, the request to put compliance information is ignored.
Type: String
Length Constraints: Maximum length of 256.
Required: No
- Items
-
Information about the compliance as defined by the resource type. For example, for a patch compliance type,
Items
includes information about the PatchSeverity, Classification, and so on.Type: Array of ComplianceItemEntry objects
Array Members: Minimum number of 0 items. Maximum number of 10000 items.
Required: Yes
- ResourceId
-
Specify an ID for this resource. For a managed node, this is the node ID.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 100.
Required: Yes
- ResourceType
-
Specify the type of resource.
ManagedInstance
is currently the only supported resource type.Type: String
Length Constraints: Minimum length of 1. Maximum length of 50.
Required: Yes
- UploadType
-
The mode for uploading compliance items. You can specify
COMPLETE
orPARTIAL
. InCOMPLETE
mode, the system overwrites all existing compliance information for the resource. You must provide a full list of compliance items each time you send the request.In
PARTIAL
mode, the system overwrites compliance information for a specific association. The association must be configured withSyncCompliance
set toMANUAL
. By default, all requests useCOMPLETE
mode.Note
This attribute is only valid for association compliance.
Type: String
Valid Values:
COMPLETE | PARTIAL
Required: No
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Errors
For information about the errors that are common to all actions, see Common Errors.
- ComplianceTypeCountLimitExceededException
-
You specified too many custom compliance types. You can specify a maximum of 10 different types.
HTTP Status Code: 400
- InternalServerError
-
An error occurred on the server side.
HTTP Status Code: 500
- InvalidItemContentException
-
One or more content items isn't valid.
HTTP Status Code: 400
- InvalidResourceId
-
The resource ID isn't valid. Verify that you entered the correct ID and try again.
HTTP Status Code: 400
- InvalidResourceType
-
The resource type isn't valid. For example, if you are attempting to tag an EC2 instance, the instance must be a registered managed node.
HTTP Status Code: 400
- ItemSizeLimitExceededException
-
The inventory item size has exceeded the size limit.
HTTP Status Code: 400
- TotalSizeLimitExceededException
-
The size of inventory data has exceeded the total size limit for the resource.
HTTP Status Code: 400
Examples
Example
This example illustrates one usage of PutComplianceItems.
Sample Request
POST / HTTP/1.1
Host: ssm.us-west-2.amazonaws.com
Accept-Encoding: identity
X-Amz-Target: AmazonSSM.PutComplianceItems
Content-Type: application/x-amz-json-1.1
User-Agent: aws-cli/2.2.27 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/ssm.put-compliance-items
X-Amz-Date: 20240811T170036Z
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20240811/us-west-2/ssm/aws4_request,
SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE
Content-Length: 260
{
"ResourceId": "i-02573cafcfEXAMPLE",
"ResourceType": "ManagedInstance",
"ComplianceType": "Custom:AVCheck",
"ExecutionSummary": {
"ExecutionTime": 1628697600
},
"Items": [
{
"Id": "Version2.0",
"Title": "ScanHost",
"Severity": "CRITICAL",
"Status": "COMPLIANT"
}
]
}
Sample Response
{}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: