Inspector.Client.
create_assessment_template
(**kwargs)¶Creates an assessment template for the assessment target that is specified by the ARN of the assessment target. If the service-linked role isn’t already registered, this action also creates and registers a service-linked role to grant Amazon Inspector access to AWS Services needed to perform security assessments.
See also: AWS API Documentation
Request Syntax
response = client.create_assessment_template(
assessmentTargetArn='string',
assessmentTemplateName='string',
durationInSeconds=123,
rulesPackageArns=[
'string',
],
userAttributesForFindings=[
{
'key': 'string',
'value': 'string'
},
]
)
[REQUIRED]
The ARN that specifies the assessment target for which you want to create the assessment template.
[REQUIRED]
The user-defined name that identifies the assessment template that you want to create. You can create several assessment templates for an assessment target. The names of the assessment templates that correspond to a particular assessment target must be unique.
[REQUIRED]
The duration of the assessment run in seconds.
[REQUIRED]
The ARNs that specify the rules packages that you want to attach to the assessment template.
The user-defined attributes that are assigned to every finding that is generated by the assessment run that uses this assessment template. An attribute is a key and value pair (an Attribute object). Within an assessment template, each key must be unique.
This data type is used as a request parameter in the AddAttributesToFindings and CreateAssessmentTemplate actions.
The attribute key.
The value assigned to the attribute key.
dict
Response Syntax
{
'assessmentTemplateArn': 'string'
}
Response Structure
(dict) --
assessmentTemplateArn (string) --
The ARN that specifies the assessment template that is created.
Exceptions
Inspector.Client.exceptions.InternalException
Inspector.Client.exceptions.InvalidInputException
Inspector.Client.exceptions.LimitExceededException
Inspector.Client.exceptions.AccessDeniedException
Inspector.Client.exceptions.NoSuchEntityException
Inspector.Client.exceptions.ServiceTemporarilyUnavailableException
Examples
Creates an assessment template for the assessment target that is specified by the ARN of the assessment target.
response = client.create_assessment_template(
assessmentTargetArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX',
assessmentTemplateName='ExampleAssessmentTemplate',
durationInSeconds=180,
rulesPackageArns=[
'arn:aws:inspector:us-west-2:758058086616:rulespackage/0-11B9DBXp',
],
userAttributesForFindings=[
{
'key': 'Example',
'value': 'example',
},
],
)
print(response)
Expected Output:
{
'assessmentTemplateArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-it5r2S4T',
'ResponseMetadata': {
'...': '...',
},
}