AWS Systems Manager Maintenance Window
This page shows how to write Terraform and CloudFormation for Systems Manager Maintenance Window and write them securely.
aws_ssm_maintenance_window (Terraform)
The Maintenance Window in Systems Manager can be configured in Terraform with the resource name aws_ssm_maintenance_window
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_ssm_maintenance_window" "maintance_Window" {
cutoff = 1
duration = 4
name = "maintenance-window"
schedule = "cron(0 0 ? * SUN *)"
Parameters
-
allow_unassociated_targets
optional - bool -
cutoff
required - number -
description
optional - string -
duration
required - number -
enabled
optional - bool -
end_date
optional - string -
id
optional computed - string -
name
required - string -
schedule
required - string -
schedule_offset
optional - number -
schedule_timezone
optional - string -
start_date
optional - string -
tags
optional - map from string to string
Explanation in Terraform Registry
Provides an SSM Maintenance Window resource
AWS::SSM::MaintenanceWindow (CloudFormation)
The MaintenanceWindow in SSM can be configured in CloudFormation with the resource name AWS::SSM::MaintenanceWindow
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::SSM::MaintenanceWindow
Properties:
AllowUnassociatedTargets: true
Cutoff: 0 # h
Schedule: "cron(0 18 ? * SAT *)" # JST: SUN-03:00
Duration: 1 # h
Type: "AWS::SSM::MaintenanceWindow"
Properties:
Description: Maintenance Window to patch Windows Server 2016 daily at 10pm
AllowUnassociatedTargets: true
Cutoff: 1
Schedule: cron(0 11 ? * * *)
Type: AWS::SSM::MaintenanceWindow
Properties:
AllowUnassociatedTargets: true
Cutoff: 0
Description: Scheduled reboot
Duration: 2
Type: AWS::SSM::MaintenanceWindow
Properties:
AllowUnassociatedTargets: True
Cutoff: 0
Description: "毎日21時にEC2を停止します"
Duration: 1
Type: "AWS::SSM::MaintenanceWindow"
Properties:
AllowUnassociatedTargets: true
Cutoff: 1
Schedule: rate(3 hours)
Duration: 2
"Type" : "AWS::SSM::MaintenanceWindow",
"Properties" : {
"Name": { "Fn::Join": ["-",[{ "Fn::FindInMap": ["CustomVariables", "PatchBaselineName","Value"]},"MaintenanceWindow","Group1","Schedule1" ]]},
"Description": { "Fn::Join": [" ",["MaintenanceWindow","Securitypatch","Updates",{ "Fn::FindInMap": ["CustomVariables", "PatchBaselineName","Value"]},"PatchGroup1","Schedule1" ]]},
"AllowUnassociatedTargets" : true,
"Cutoff" : 1,
"Type": "AWS::SSM::MaintenanceWindow",
"Properties": {
"Description": "Maintenance window for ScanPatchInfoNoRebootSystems",
"AllowUnassociatedTargets": {
"Ref": "AllowUnregisteredTargets"
},
"path": "/ResourceTypes/AWS::SSM::MaintenanceWindow/Properties/Cutoff/Value",
"value": {
"ValueType": "AWS::SSM::MaintenanceWindow.Cutoff"
}
},
{
"Type": "AWS::SSM::MaintenanceWindow",
"Properties": {
"AllowUnassociatedTargets": true,
"Cutoff": 1,
"Duration": 2,
"Name": "Windows-Maintainance-Window",
"path": "/ResourceTypes/AWS::SSM::MaintenanceWindow/Properties/Cutoff/Value",
"value": {
"ValueType": "AWS::SSM::MaintenanceWindow.Cutoff"
}
},
{
Parameters
-
StartDate
optional - String -
Description
optional - String -
AllowUnassociatedTargets
required - Boolean -
Cutoff
required - Integer -
Schedule
required - String -
Duration
required - Integer -
ScheduleOffset
optional - Integer -
EndDate
optional - String -
Tags
optional - List of Tag -
Name
required - String -
ScheduleTimezone
optional - String
Explanation in CloudFormation Registry
The
AWS::SSM::MaintenanceWindow
resource represents general information about a maintenance window for AWS Systems Manager. Maintenance Windows let you define a schedule for when to perform potentially disruptive actions on your instances, such as patching an operating system (OS), updating drivers, or installing software. Each maintenance window has a schedule, a duration, a set of registered targets, and a set of registered tasks. For more information, see Systems Manager Maintenance Windows in the AWS Systems Manager User Guide and CreateMaintenanceWindow in the AWS Systems Manager API Reference.
Frequently asked questions
What is AWS Systems Manager Maintenance Window?
AWS Systems Manager Maintenance Window is a resource for Systems Manager of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Systems Manager Maintenance Window?
For Terraform, the Ndomi/terraform source code example is useful. See the Terraform Example section for further details.
For CloudFormation, the matsuura0831/aws, sednanref/learning and stuartellis/ec2-evergreen source code examples are useful. See the CloudFormation Example section for further details.