Creates a patch baseline.
Note
For information about valid key-value pairs in PatchFilters
for each supported operating system type, see PatchFilter .
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
create-patch-baseline
[--operating-system <value>]
--name <value>
[--global-filters <value>]
[--approval-rules <value>]
[--approved-patches <value>]
[--approved-patches-compliance-level <value>]
[--approved-patches-enable-non-security | --no-approved-patches-enable-non-security]
[--rejected-patches <value>]
[--rejected-patches-action <value>]
[--description <value>]
[--sources <value>]
[--client-token <value>]
[--tags <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--operating-system
(string)
Defines the operating system the patch baseline applies to. The default value is
WINDOWS
.Possible values:
WINDOWS
AMAZON_LINUX
AMAZON_LINUX_2
UBUNTU
REDHAT_ENTERPRISE_LINUX
SUSE
CENTOS
ORACLE_LINUX
DEBIAN
MACOS
--name
(string)
The name of the patch baseline.
--global-filters
(structure)
A set of global filters used to include patches in the baseline.
PatchFilters -> (list)
The set of patch filters that make up the group.
(structure)
Defines which patches should be included in a patch baseline.
A patch filter consists of a key and a set of values. The filter key is a patch property. For example, the available filter keys for
WINDOWS
arePATCH_SET
,PRODUCT
,PRODUCT_FAMILY
,CLASSIFICATION
, andMSRC_SEVERITY
.The filter values define a matching criterion for the patch property indicated by the key. For example, if the filter key is
PRODUCT
and the filter values are["Office 2013", "Office 2016"]
, then the filter accepts all patches where product name is either “Office 2013” or “Office 2016”. The filter values can be exact values for the patch property given as a key, or a wildcard (*), which matches all values.You can view lists of valid values for the patch properties by running the
DescribePatchProperties
command. For information about which patch properties can be used with each major operating system, see DescribePatchProperties .Key -> (string)
The key for the filter.
Run the DescribePatchProperties command to view lists of valid keys for each operating system type.
Values -> (list)
The value for the filter key.
Run the DescribePatchProperties command to view lists of valid values for each key based on operating system type.
(string)
JSON Syntax:
{
"PatchFilters": [
{
"Key": "ARCH"|"ADVISORY_ID"|"BUGZILLA_ID"|"PATCH_SET"|"PRODUCT"|"PRODUCT_FAMILY"|"CLASSIFICATION"|"CVE_ID"|"EPOCH"|"MSRC_SEVERITY"|"NAME"|"PATCH_ID"|"SECTION"|"PRIORITY"|"REPOSITORY"|"RELEASE"|"SEVERITY"|"SECURITY"|"VERSION",
"Values": ["string", ...]
}
...
]
}
--approval-rules
(structure)
A set of rules used to include patches in the baseline.
PatchRules -> (list)
The rules that make up the rule group.
(structure)
Defines an approval rule for a patch baseline.
PatchFilterGroup -> (structure)
The patch filter group that defines the criteria for the rule.
PatchFilters -> (list)
The set of patch filters that make up the group.
(structure)
Defines which patches should be included in a patch baseline.
A patch filter consists of a key and a set of values. The filter key is a patch property. For example, the available filter keys for
WINDOWS
arePATCH_SET
,PRODUCT
,PRODUCT_FAMILY
,CLASSIFICATION
, andMSRC_SEVERITY
.The filter values define a matching criterion for the patch property indicated by the key. For example, if the filter key is
PRODUCT
and the filter values are["Office 2013", "Office 2016"]
, then the filter accepts all patches where product name is either “Office 2013” or “Office 2016”. The filter values can be exact values for the patch property given as a key, or a wildcard (*), which matches all values.You can view lists of valid values for the patch properties by running the
DescribePatchProperties
command. For information about which patch properties can be used with each major operating system, see DescribePatchProperties .Key -> (string)
The key for the filter.
Run the DescribePatchProperties command to view lists of valid keys for each operating system type.
Values -> (list)
The value for the filter key.
Run the DescribePatchProperties command to view lists of valid values for each key based on operating system type.
(string)
ComplianceLevel -> (string)
A compliance severity level for all approved patches in a patch baseline.
ApproveAfterDays -> (integer)
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. Not supported on Debian Server or Ubuntu Server.ApproveUntilDate -> (string)
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
.EnableNonSecurity -> (boolean)
For instances 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 instances only.
JSON Syntax:
{
"PatchRules": [
{
"PatchFilterGroup": {
"PatchFilters": [
{
"Key": "ARCH"|"ADVISORY_ID"|"BUGZILLA_ID"|"PATCH_SET"|"PRODUCT"|"PRODUCT_FAMILY"|"CLASSIFICATION"|"CVE_ID"|"EPOCH"|"MSRC_SEVERITY"|"NAME"|"PATCH_ID"|"SECTION"|"PRIORITY"|"REPOSITORY"|"RELEASE"|"SEVERITY"|"SECURITY"|"VERSION",
"Values": ["string", ...]
}
...
]
},
"ComplianceLevel": "CRITICAL"|"HIGH"|"MEDIUM"|"LOW"|"INFORMATIONAL"|"UNSPECIFIED",
"ApproveAfterDays": integer,
"ApproveUntilDate": "string",
"EnableNonSecurity": true|false
}
...
]
}
--approved-patches
(list)
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 Amazon Web Services Systems Manager User Guide .
(string)
Syntax:
"string" "string" ...
--approved-patches-compliance-level
(string)
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
.Possible values:
CRITICAL
HIGH
MEDIUM
LOW
INFORMATIONAL
UNSPECIFIED
--approved-patches-enable-non-security
| --no-approved-patches-enable-non-security
(boolean)
Indicates whether the list of approved patches includes non-security updates that should be applied to the instances. The default value is
false
. Applies to Linux instances only.
--rejected-patches
(list)
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 Amazon Web Services Systems Manager User Guide .
(string)
Syntax:
"string" "string" ...
--rejected-patches-action
(string)
The action for Patch Manager to take on patches included in the
RejectedPackages
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
.Possible values:
ALLOW_AS_DEPENDENCY
BLOCK
--description
(string)
A description of the patch baseline.
--sources
(list)
Information about the patches to use to update the instances, including target operating systems and source repositories. Applies to Linux instances only.
(structure)
Information about the patches to use to update the instances, including target operating systems and source repository. Applies to Linux instances only.
Name -> (string)
The name specified to identify the patch source.
Products -> (list)
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 .
(string)
Configuration -> (string)
The value of the yum repo configuration. For example:
[main]
name=MyCustomRepository
baseurl=https://my-custom-repository
enabled=1
Note
For information about other options available for your yum repository configuration, see dnf.conf(5) .
Shorthand Syntax:
Name=string,Products=string,string,Configuration=string ...
JSON Syntax:
[
{
"Name": "string",
"Products": ["string", ...],
"Configuration": "string"
}
...
]
--client-token
(string)
User-provided idempotency token.
--tags
(list)
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. In this case, you could specify the following key-value pairs:
Key=PatchSeverity,Value=Critical
Key=OS,Value=Windows
Note
To add tags to an existing patch baseline, use the AddTagsToResource operation.
(structure)
Metadata that you assign to your Amazon Web Services resources. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment. In Amazon Web Services Systems Manager, you can apply tags to Systems Manager documents (SSM documents), managed instances, maintenance windows, parameters, patch baselines, OpsItems, and OpsMetadata.
Key -> (string)
The name of the tag.
Value -> (string)
The value of the tag.
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
Example 1: To create a patch baseline with auto-approval
The following create-patch-baseline
example creates a patch baseline for Windows Server that approves patches for a production environment seven days after they are released by Microsoft.
aws ssm create-patch-baseline \
--name "Windows-Production-Baseline-AutoApproval" \
--operating-system "WINDOWS" \
--approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important,Moderate]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,UpdateRollups,CriticalUpdates]}]},ApproveAfterDays=7}]" \
--description "Baseline containing all updates approved for Windows Server production systems"
Output:
{
"BaselineId": "pb-045f10b4f3EXAMPLE"
}
Example 2: To create a patch baseline with an approval cutoff date
The following create-patch-baseline
example creates a patch baseline for Windows Server that approves all patches for a production environment that are released on or before July 7, 2020.
aws ssm create-patch-baseline \
--name "Windows-Production-Baseline-AutoApproval" \
--operating-system "WINDOWS" \
--approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important,Moderate]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,UpdateRollups,CriticalUpdates]}]},ApproveUntilDate=2020-07-07}]" \
--description "Baseline containing all updates approved for Windows Server production systems"
Output:
{
"BaselineId": "pb-045f10b4f3EXAMPLE"
}
Example 3: To create a patch baseline with approval rules stored in a JSON file
The following create-patch-baseline
example creates a patch baseline for Amazon Linux 2017.09 that approves patches for a production environment seven days after they are released, specifies approval rules for the patch baseline, and specifies a custom repository for patches.
aws ssm create-patch-baseline \
--cli-input-json file://my-amazon-linux-approval-rules-and-repo.json
Contents of my-amazon-linux-approval-rules-and-repo.json
:
{
"Name": "Amazon-Linux-2017.09-Production-Baseline",
"Description": "My approval rules patch baseline for Amazon Linux 2017.09 instances",
"OperatingSystem": "AMAZON_LINUX",
"Tags": [
{
"Key": "Environment",
"Value": "Production"
}
],
"ApprovalRules": {
"PatchRules": [
{
"ApproveAfterDays": 7,
"EnableNonSecurity": true,
"PatchFilterGroup": {
"PatchFilters": [
{
"Key": "SEVERITY",
"Values": [
"Important",
"Critical"
]
},
{
"Key": "CLASSIFICATION",
"Values": [
"Security",
"Bugfix"
]
},
{
"Key": "PRODUCT",
"Values": [
"AmazonLinux2017.09"
]
}
]
}
}
]
},
"Sources": [
{
"Name": "My-AL2017.09",
"Products": [
"AmazonLinux2017.09"
],
"Configuration": "[amzn-main] \nname=amzn-main-Base\nmirrorlist=http://repo./$awsregion./$awsdomain//$releasever/main/mirror.list //nmirrorlist_expire=300//nmetadata_expire=300 \npriority=10 \nfailovermethod=priority \nfastestmirror_enabled=0 \ngpgcheck=1 \ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga \nenabled=1 \nretries=3 \ntimeout=5\nreport_instanceid=yes"
}
]
}
Example 4: To create a patch baseline that specifies approved and rejected patches
The following create-patch-baseline
example explicitly specifies patches to approve and reject as exception to the default approval rules.
aws ssm create-patch-baseline \
--name "Amazon-Linux-2017.09-Alpha-Baseline" \
--description "My custom approve/reject patch baseline for Amazon Linux 2017.09 instances" \
--operating-system "AMAZON_LINUX" \
--approved-patches "CVE-2018-1234567,example-pkg-EE-2018*.amzn1.noarch" \
--approved-patches-compliance-level "HIGH" \
--approved-patches-enable-non-security \
--tags "Key=Environment,Value=Alpha"
For more information, see Create a Custom Patch Baseline in the AWS Systems Manager User Guide.