CfnPatchBaseline
- class aws_cdk.aws_ssm.CfnPatchBaseline(scope, id, *, name, approval_rules=None, approved_patches=None, approved_patches_compliance_level=None, approved_patches_enable_non_security=None, description=None, global_filters=None, operating_system=None, patch_groups=None, rejected_patches=None, rejected_patches_action=None, sources=None, tags=None)
Bases:
CfnResource
A CloudFormation
AWS::SSM::PatchBaseline
.The
AWS::SSM::PatchBaseline
resource defines the basic information for an AWS Systems Manager patch baseline. A patch baseline defines which patches are approved for installation on your instances.For more information, see CreatePatchBaseline in the AWS Systems Manager API Reference .
- CloudformationResource:
AWS::SSM::PatchBaseline
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm cfn_patch_baseline = ssm.CfnPatchBaseline(self, "MyCfnPatchBaseline", name="name", # the properties below are optional approval_rules=ssm.CfnPatchBaseline.RuleGroupProperty( patch_rules=[ssm.CfnPatchBaseline.RuleProperty( approve_after_days=123, approve_until_date="approveUntilDate", compliance_level="complianceLevel", enable_non_security=False, patch_filter_group=ssm.CfnPatchBaseline.PatchFilterGroupProperty( patch_filters=[ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )] ) )] ), approved_patches=["approvedPatches"], approved_patches_compliance_level="approvedPatchesComplianceLevel", approved_patches_enable_non_security=False, description="description", global_filters=ssm.CfnPatchBaseline.PatchFilterGroupProperty( patch_filters=[ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )] ), operating_system="operatingSystem", patch_groups=["patchGroups"], rejected_patches=["rejectedPatches"], rejected_patches_action="rejectedPatchesAction", sources=[ssm.CfnPatchBaseline.PatchSourceProperty( configuration="configuration", name="name", products=["products"] )], tags=[CfnTag( key="key", value="value" )] )
Create a new
AWS::SSM::PatchBaseline
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
name (
str
) – The name of the patch baseline.approval_rules (
Union
[IResolvable
,RuleGroupProperty
,Dict
[str
,Any
],None
]) – A set of rules used to include patches in the baseline.approved_patches (
Optional
[Sequence
[str
]]) – A list of explicitly approved patches for the baseline. For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide .approved_patches_compliance_level (
Optional
[str
]) – Defines the compliance level for approved patches. When an approved patch is reported as missing, this value describes the severity of the compliance violation. The default value isUNSPECIFIED
.approved_patches_enable_non_security (
Union
[bool
,IResolvable
,None
]) – Indicates whether the list of approved patches includes non-security updates that should be applied to the managed nodes. The default value isfalse
. Applies to Linux managed nodes only.description (
Optional
[str
]) – A description of the patch baseline.global_filters (
Union
[IResolvable
,PatchFilterGroupProperty
,Dict
[str
,Any
],None
]) – A set of global filters used to include patches in the baseline.operating_system (
Optional
[str
]) – Defines the operating system the patch baseline applies to. The default value isWINDOWS
.patch_groups (
Optional
[Sequence
[str
]]) – The name of the patch group to be registered with the patch baseline.rejected_patches (
Optional
[Sequence
[str
]]) –A list of explicitly rejected patches for the baseline. For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide .
rejected_patches_action (
Optional
[str
]) – The action for Patch Manager to take on patches included in theRejectedPackages
list. - ``ALLOW_AS_DEPENDENCY`` : A package in theRejected
patches list is installed only if it is a dependency of another package. It is considered compliant with the patch baseline, and its status is reported asInstalledOther
. This is the default action if no option is specified. - ``BLOCK`` : Packages in theRejectedPatches
list, and packages that include them as dependencies, aren’t installed under any circumstances. If a package was installed before it was added to the Rejected patches list, it is considered non-compliant with the patch baseline, and its status is reported asInstalledRejected
.sources (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PatchSourceProperty
,Dict
[str
,Any
]]],None
]) – Information about the patches to use to update the managed nodes, including target operating systems and source repositories. Applies to Linux managed nodes only.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Optional metadata that you assign to a resource. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a patch baseline to identify the severity level of patches it specifies and the operating system family it applies to.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::SSM::PatchBaseline'
- approval_rules
A set of rules used to include patches in the baseline.
- approved_patches
A list of explicitly approved patches for the baseline.
For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide .
- approved_patches_compliance_level
Defines the compliance level for approved patches.
When an approved patch is reported as missing, this value describes the severity of the compliance violation. The default value is
UNSPECIFIED
.
- approved_patches_enable_non_security
Indicates whether the list of approved patches includes non-security updates that should be applied to the managed nodes.
The default value is
false
. Applies to Linux managed nodes only.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- description
A description of the patch baseline.
- global_filters
A set of global filters used to include patches in the baseline.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- name
The name of the patch baseline.
- node
The construct tree node associated with this construct.
- operating_system
Defines the operating system the patch baseline applies to.
The default value is
WINDOWS
.
- patch_groups
The name of the patch group to be registered with the patch baseline.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- rejected_patches
A list of explicitly rejected patches for the baseline.
For information about accepted formats for lists of approved patches and rejected patches, see About package name formats for approved and rejected patch lists in the AWS Systems Manager User Guide .
- rejected_patches_action
The action for Patch Manager to take on patches included in the
RejectedPackages
list.``ALLOW_AS_DEPENDENCY`` : A package in the
Rejected
patches list is installed only if it is a dependency of another package. It is considered compliant with the patch baseline, and its status is reported asInstalledOther
. This is the default action if no option is specified.``BLOCK`` : Packages in the
RejectedPatches
list, and packages that include them as dependencies, aren’t installed under any circumstances. If a package was installed before it was added to the Rejected patches list, it is considered non-compliant with the patch baseline, and its status is reported asInstalledRejected
.
- sources
Information about the patches to use to update the managed nodes, including target operating systems and source repositories.
Applies to Linux managed nodes only.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Optional metadata that you assign to a resource.
Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a patch baseline to identify the severity level of patches it specifies and the operating system family it applies to.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
) –- Return type:
bool
PatchFilterGroupProperty
- class CfnPatchBaseline.PatchFilterGroupProperty(*, patch_filters=None)
Bases:
object
The
PatchFilterGroup
property type specifies a set of patch filters for an AWS Systems Manager patch baseline, typically used for approval rules for a Systems Manager patch baseline.PatchFilterGroup
is the property type for theGlobalFilters
property of the AWS::SSM::PatchBaseline resource and thePatchFilterGroup
property of the Rule property type.- Parameters:
patch_filters (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PatchFilterProperty
,Dict
[str
,Any
]]],None
]) – The set of patch filters that make up the group.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm patch_filter_group_property = ssm.CfnPatchBaseline.PatchFilterGroupProperty( patch_filters=[ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )] )
Attributes
- patch_filters
The set of patch filters that make up the group.
PatchFilterProperty
- class CfnPatchBaseline.PatchFilterProperty(*, key=None, values=None)
Bases:
object
The
PatchFilter
property type defines a patch filter for an AWS Systems Manager patch baseline.The
PatchFilters
property of the PatchFilterGroup property type contains a list ofPatchFilter
property types.You can view lists of valid values for the patch properties by running the
DescribePatchProperties
command. For more information, see DescribePatchProperties in the AWS Systems Manager API Reference .- Parameters:
key (
Optional
[str
]) – The key for the filter. For information about valid keys, see PatchFilter in the AWS Systems Manager API Reference .values (
Optional
[Sequence
[str
]]) –The value for the filter key. For information about valid values for each key based on operating system type, see PatchFilter in the AWS Systems Manager API Reference .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm patch_filter_property = ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )
Attributes
- key
The key for the filter.
For information about valid keys, see PatchFilter in the AWS Systems Manager API Reference .
- values
The value for the filter key.
For information about valid values for each key based on operating system type, see PatchFilter in the AWS Systems Manager API Reference .
PatchSourceProperty
- class CfnPatchBaseline.PatchSourceProperty(*, configuration=None, name=None, products=None)
Bases:
object
PatchSource
is the property type for theSources
resource of the AWS::SSM::PatchBaseline resource.The AWS CloudFormation
AWS::SSM::PatchSource
resource is used to provide information about the patches to use to update target instances, including target operating systems and source repository. Applies to Linux instances only.- Parameters:
configuration (
Optional
[str
]) – The value of the yum repo configuration. For example:.[main]
name=MyCustomRepository
baseurl=https://my-custom-repository
enabled=1
.. epigraph:: For information about other options available for your yum repository configuration, see dnf.conf(5) .name (
Optional
[str
]) – The name specified to identify the patch source.products (
Optional
[Sequence
[str
]]) –The specific operating system versions a patch repository applies to, such as “Ubuntu16.04”, “AmazonLinux2016.09”, “RedhatEnterpriseLinux7.2” or “Suse12.7”. For lists of supported product values, see PatchFilter in the AWS Systems Manager API Reference .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm patch_source_property = ssm.CfnPatchBaseline.PatchSourceProperty( configuration="configuration", name="name", products=["products"] )
Attributes
- configuration
.
[main]
name=MyCustomRepository
baseurl=https://my-custom-repository
enabled=1
.. epigraph:For information about other options available for your yum repository configuration, see `dnf.conf(5) <https://docs.aws.amazon.com/https://man7.org/linux/man-pages/man5/dnf.conf.5.html>`_ .
- Link:
- Type:
The value of the yum repo configuration. For example
- name
The name specified to identify the patch source.
- products
//docs.aws.amazon.com/systems-manager/latest/APIReference/API_PatchFilter.html>`_ in the AWS Systems Manager API Reference .
- Link:
- Type:
The specific operating system versions a patch repository applies to, such as “Ubuntu16.04”, “AmazonLinux2016.09”, “RedhatEnterpriseLinux7.2” or “Suse12.7”. For lists of supported product values, see `PatchFilter <https
RuleGroupProperty
- class CfnPatchBaseline.RuleGroupProperty(*, patch_rules=None)
Bases:
object
The
RuleGroup
property type specifies a set of rules that define the approval rules for an AWS Systems Manager patch baseline.RuleGroup
is the property type for theApprovalRules
property of the AWS::SSM::PatchBaseline resource.- Parameters:
patch_rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RuleProperty
,Dict
[str
,Any
]]],None
]) – The rules that make up the rule group.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm rule_group_property = ssm.CfnPatchBaseline.RuleGroupProperty( patch_rules=[ssm.CfnPatchBaseline.RuleProperty( approve_after_days=123, approve_until_date="approveUntilDate", compliance_level="complianceLevel", enable_non_security=False, patch_filter_group=ssm.CfnPatchBaseline.PatchFilterGroupProperty( patch_filters=[ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )] ) )] )
Attributes
- patch_rules
The rules that make up the rule group.
RuleProperty
- class CfnPatchBaseline.RuleProperty(*, approve_after_days=None, approve_until_date=None, compliance_level=None, enable_non_security=None, patch_filter_group=None)
Bases:
object
The
Rule
property type specifies an approval rule for a Systems Manager patch baseline.The
PatchRules
property of the RuleGroup property type contains a list ofRule
property types.- Parameters:
approve_after_days (
Union
[int
,float
,None
]) – The number of days after the release date of each patch matched by the rule that the patch is marked as approved in the patch baseline. For example, a value of7
means that patches are approved seven days after they are released. You must specify a value forApproveAfterDays
. Exception: Not supported on Debian Server or Ubuntu Server.approve_until_date (
Optional
[str
]) – The cutoff date for auto approval of released patches. Any patches released on or before this date are installed automatically. Not supported on Debian Server or Ubuntu Server. Enter dates in the formatYYYY-MM-DD
. For example,2021-12-31
.compliance_level (
Optional
[str
]) – A compliance severity level for all approved patches in a patch baseline. Valid compliance severity levels include the following:UNSPECIFIED
,CRITICAL
,HIGH
,MEDIUM
,LOW
, andINFORMATIONAL
.enable_non_security (
Union
[bool
,IResolvable
,None
]) – For managed nodes identified by the approval rule filters, enables a patch baseline to apply non-security updates available in the specified repository. The default value isfalse
. Applies to Linux managed nodes only.patch_filter_group (
Union
[IResolvable
,PatchFilterGroupProperty
,Dict
[str
,Any
],None
]) – The patch filter group that defines the criteria for the rule.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ssm as ssm rule_property = ssm.CfnPatchBaseline.RuleProperty( approve_after_days=123, approve_until_date="approveUntilDate", compliance_level="complianceLevel", enable_non_security=False, patch_filter_group=ssm.CfnPatchBaseline.PatchFilterGroupProperty( patch_filters=[ssm.CfnPatchBaseline.PatchFilterProperty( key="key", values=["values"] )] ) )
Attributes
- approve_after_days
The number of days after the release date of each patch matched by the rule that the patch is marked as approved in the patch baseline.
For example, a value of
7
means that patches are approved seven days after they are released.You must specify a value for
ApproveAfterDays
.Exception: Not supported on Debian Server or Ubuntu Server.
- approve_until_date
The cutoff date for auto approval of released patches.
Any patches released on or before this date are installed automatically. Not supported on Debian Server or Ubuntu Server.
Enter dates in the format
YYYY-MM-DD
. For example,2021-12-31
.
- compliance_level
A compliance severity level for all approved patches in a patch baseline.
Valid compliance severity levels include the following:
UNSPECIFIED
,CRITICAL
,HIGH
,MEDIUM
,LOW
, andINFORMATIONAL
.
- enable_non_security
For managed nodes identified by the approval rule filters, enables a patch baseline to apply non-security updates available in the specified repository.
The default value is
false
. Applies to Linux managed nodes only.
- patch_filter_group
The patch filter group that defines the criteria for the rule.