aws logo
AWS Classic v5.34.0, Mar 30 23

aws.ssm.MaintenanceWindowTarget

Provides an SSM Maintenance Window Target resource

Example Usage

Instance Target

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var window = new Aws.Ssm.MaintenanceWindow("window", new()
    {
        Schedule = "cron(0 16 ? * TUE *)",
        Duration = 3,
        Cutoff = 1,
    });

    var target1 = new Aws.Ssm.MaintenanceWindowTarget("target1", new()
    {
        WindowId = window.Id,
        Description = "This is a maintenance window target",
        ResourceType = "INSTANCE",
        Targets = new[]
        {
            new Aws.Ssm.Inputs.MaintenanceWindowTargetTargetArgs
            {
                Key = "tag:Name",
                Values = new[]
                {
                    "acceptance_test",
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ssm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		window, err := ssm.NewMaintenanceWindow(ctx, "window", &ssm.MaintenanceWindowArgs{
			Schedule: pulumi.String("cron(0 16 ? * TUE *)"),
			Duration: pulumi.Int(3),
			Cutoff:   pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		_, err = ssm.NewMaintenanceWindowTarget(ctx, "target1", &ssm.MaintenanceWindowTargetArgs{
			WindowId:     window.ID(),
			Description:  pulumi.String("This is a maintenance window target"),
			ResourceType: pulumi.String("INSTANCE"),
			Targets: ssm.MaintenanceWindowTargetTargetArray{
				&ssm.MaintenanceWindowTargetTargetArgs{
					Key: pulumi.String("tag:Name"),
					Values: pulumi.StringArray{
						pulumi.String("acceptance_test"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssm.MaintenanceWindow;
import com.pulumi.aws.ssm.MaintenanceWindowArgs;
import com.pulumi.aws.ssm.MaintenanceWindowTarget;
import com.pulumi.aws.ssm.MaintenanceWindowTargetArgs;
import com.pulumi.aws.ssm.inputs.MaintenanceWindowTargetTargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var window = new MaintenanceWindow("window", MaintenanceWindowArgs.builder()        
            .schedule("cron(0 16 ? * TUE *)")
            .duration(3)
            .cutoff(1)
            .build());

        var target1 = new MaintenanceWindowTarget("target1", MaintenanceWindowTargetArgs.builder()        
            .windowId(window.id())
            .description("This is a maintenance window target")
            .resourceType("INSTANCE")
            .targets(MaintenanceWindowTargetTargetArgs.builder()
                .key("tag:Name")
                .values("acceptance_test")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

window = aws.ssm.MaintenanceWindow("window",
    schedule="cron(0 16 ? * TUE *)",
    duration=3,
    cutoff=1)
target1 = aws.ssm.MaintenanceWindowTarget("target1",
    window_id=window.id,
    description="This is a maintenance window target",
    resource_type="INSTANCE",
    targets=[aws.ssm.MaintenanceWindowTargetTargetArgs(
        key="tag:Name",
        values=["acceptance_test"],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const window = new aws.ssm.MaintenanceWindow("window", {
    schedule: "cron(0 16 ? * TUE *)",
    duration: 3,
    cutoff: 1,
});
const target1 = new aws.ssm.MaintenanceWindowTarget("target1", {
    windowId: window.id,
    description: "This is a maintenance window target",
    resourceType: "INSTANCE",
    targets: [{
        key: "tag:Name",
        values: ["acceptance_test"],
    }],
});
resources:
  window:
    type: aws:ssm:MaintenanceWindow
    properties:
      schedule: cron(0 16 ? * TUE *)
      duration: 3
      cutoff: 1
  target1:
    type: aws:ssm:MaintenanceWindowTarget
    properties:
      windowId: ${window.id}
      description: This is a maintenance window target
      resourceType: INSTANCE
      targets:
        - key: tag:Name
          values:
            - acceptance_test

Resource Group Target

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var window = new Aws.Ssm.MaintenanceWindow("window", new()
    {
        Schedule = "cron(0 16 ? * TUE *)",
        Duration = 3,
        Cutoff = 1,
    });

    var target1 = new Aws.Ssm.MaintenanceWindowTarget("target1", new()
    {
        WindowId = window.Id,
        Description = "This is a maintenance window target",
        ResourceType = "RESOURCE_GROUP",
        Targets = new[]
        {
            new Aws.Ssm.Inputs.MaintenanceWindowTargetTargetArgs
            {
                Key = "resource-groups:ResourceTypeFilters",
                Values = new[]
                {
                    "AWS::EC2::Instance",
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ssm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		window, err := ssm.NewMaintenanceWindow(ctx, "window", &ssm.MaintenanceWindowArgs{
			Schedule: pulumi.String("cron(0 16 ? * TUE *)"),
			Duration: pulumi.Int(3),
			Cutoff:   pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		_, err = ssm.NewMaintenanceWindowTarget(ctx, "target1", &ssm.MaintenanceWindowTargetArgs{
			WindowId:     window.ID(),
			Description:  pulumi.String("This is a maintenance window target"),
			ResourceType: pulumi.String("RESOURCE_GROUP"),
			Targets: ssm.MaintenanceWindowTargetTargetArray{
				&ssm.MaintenanceWindowTargetTargetArgs{
					Key: pulumi.String("resource-groups:ResourceTypeFilters"),
					Values: pulumi.StringArray{
						pulumi.String("AWS::EC2::Instance"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssm.MaintenanceWindow;
import com.pulumi.aws.ssm.MaintenanceWindowArgs;
import com.pulumi.aws.ssm.MaintenanceWindowTarget;
import com.pulumi.aws.ssm.MaintenanceWindowTargetArgs;
import com.pulumi.aws.ssm.inputs.MaintenanceWindowTargetTargetArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var window = new MaintenanceWindow("window", MaintenanceWindowArgs.builder()        
            .schedule("cron(0 16 ? * TUE *)")
            .duration(3)
            .cutoff(1)
            .build());

        var target1 = new MaintenanceWindowTarget("target1", MaintenanceWindowTargetArgs.builder()        
            .windowId(window.id())
            .description("This is a maintenance window target")
            .resourceType("RESOURCE_GROUP")
            .targets(MaintenanceWindowTargetTargetArgs.builder()
                .key("resource-groups:ResourceTypeFilters")
                .values("AWS::EC2::Instance")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

window = aws.ssm.MaintenanceWindow("window",
    schedule="cron(0 16 ? * TUE *)",
    duration=3,
    cutoff=1)
target1 = aws.ssm.MaintenanceWindowTarget("target1",
    window_id=window.id,
    description="This is a maintenance window target",
    resource_type="RESOURCE_GROUP",
    targets=[aws.ssm.MaintenanceWindowTargetTargetArgs(
        key="resource-groups:ResourceTypeFilters",
        values=["AWS::EC2::Instance"],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const window = new aws.ssm.MaintenanceWindow("window", {
    schedule: "cron(0 16 ? * TUE *)",
    duration: 3,
    cutoff: 1,
});
const target1 = new aws.ssm.MaintenanceWindowTarget("target1", {
    windowId: window.id,
    description: "This is a maintenance window target",
    resourceType: "RESOURCE_GROUP",
    targets: [{
        key: "resource-groups:ResourceTypeFilters",
        values: ["AWS::EC2::Instance"],
    }],
});
resources:
  window:
    type: aws:ssm:MaintenanceWindow
    properties:
      schedule: cron(0 16 ? * TUE *)
      duration: 3
      cutoff: 1
  target1:
    type: aws:ssm:MaintenanceWindowTarget
    properties:
      windowId: ${window.id}
      description: This is a maintenance window target
      resourceType: RESOURCE_GROUP
      targets:
        - key: resource-groups:ResourceTypeFilters
          values:
            - AWS::EC2::Instance

Create MaintenanceWindowTarget Resource

new MaintenanceWindowTarget(name: string, args: MaintenanceWindowTargetArgs, opts?: CustomResourceOptions);
@overload
def MaintenanceWindowTarget(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            description: Optional[str] = None,
                            name: Optional[str] = None,
                            owner_information: Optional[str] = None,
                            resource_type: Optional[str] = None,
                            targets: Optional[Sequence[MaintenanceWindowTargetTargetArgs]] = None,
                            window_id: Optional[str] = None)
@overload
def MaintenanceWindowTarget(resource_name: str,
                            args: MaintenanceWindowTargetArgs,
                            opts: Optional[ResourceOptions] = None)
func NewMaintenanceWindowTarget(ctx *Context, name string, args MaintenanceWindowTargetArgs, opts ...ResourceOption) (*MaintenanceWindowTarget, error)
public MaintenanceWindowTarget(string name, MaintenanceWindowTargetArgs args, CustomResourceOptions? opts = null)
public MaintenanceWindowTarget(String name, MaintenanceWindowTargetArgs args)
public MaintenanceWindowTarget(String name, MaintenanceWindowTargetArgs args, CustomResourceOptions options)
type: aws:ssm:MaintenanceWindowTarget
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args MaintenanceWindowTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args MaintenanceWindowTargetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MaintenanceWindowTargetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MaintenanceWindowTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args MaintenanceWindowTargetArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

MaintenanceWindowTarget Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The MaintenanceWindowTarget resource accepts the following input properties:

ResourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

Targets List<Pulumi.Aws.Ssm.Inputs.MaintenanceWindowTargetTargetArgs>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

WindowId string

The Id of the maintenance window to register the target with.

Description string

The description of the maintenance window target.

Name string

The name of the maintenance window target.

OwnerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

ResourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

Targets []MaintenanceWindowTargetTargetArgs

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

WindowId string

The Id of the maintenance window to register the target with.

Description string

The description of the maintenance window target.

Name string

The name of the maintenance window target.

OwnerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType String

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets List<MaintenanceWindowTargetTargetArgs>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId String

The Id of the maintenance window to register the target with.

description String

The description of the maintenance window target.

name String

The name of the maintenance window target.

ownerInformation String

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets MaintenanceWindowTargetTargetArgs[]

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId string

The Id of the maintenance window to register the target with.

description string

The description of the maintenance window target.

name string

The name of the maintenance window target.

ownerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resource_type str

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets Sequence[MaintenanceWindowTargetTargetArgs]

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

window_id str

The Id of the maintenance window to register the target with.

description str

The description of the maintenance window target.

name str

The name of the maintenance window target.

owner_information str

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType String

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets List<Property Map>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId String

The Id of the maintenance window to register the target with.

description String

The description of the maintenance window target.

name String

The name of the maintenance window target.

ownerInformation String

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

Outputs

All input properties are implicitly available as output properties. Additionally, the MaintenanceWindowTarget resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing MaintenanceWindowTarget Resource

Get an existing MaintenanceWindowTarget resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MaintenanceWindowTargetState, opts?: CustomResourceOptions): MaintenanceWindowTarget
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        owner_information: Optional[str] = None,
        resource_type: Optional[str] = None,
        targets: Optional[Sequence[MaintenanceWindowTargetTargetArgs]] = None,
        window_id: Optional[str] = None) -> MaintenanceWindowTarget
func GetMaintenanceWindowTarget(ctx *Context, name string, id IDInput, state *MaintenanceWindowTargetState, opts ...ResourceOption) (*MaintenanceWindowTarget, error)
public static MaintenanceWindowTarget Get(string name, Input<string> id, MaintenanceWindowTargetState? state, CustomResourceOptions? opts = null)
public static MaintenanceWindowTarget get(String name, Output<String> id, MaintenanceWindowTargetState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string

The description of the maintenance window target.

Name string

The name of the maintenance window target.

OwnerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

ResourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

Targets List<Pulumi.Aws.Ssm.Inputs.MaintenanceWindowTargetTargetArgs>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

WindowId string

The Id of the maintenance window to register the target with.

Description string

The description of the maintenance window target.

Name string

The name of the maintenance window target.

OwnerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

ResourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

Targets []MaintenanceWindowTargetTargetArgs

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

WindowId string

The Id of the maintenance window to register the target with.

description String

The description of the maintenance window target.

name String

The name of the maintenance window target.

ownerInformation String

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType String

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets List<MaintenanceWindowTargetTargetArgs>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId String

The Id of the maintenance window to register the target with.

description string

The description of the maintenance window target.

name string

The name of the maintenance window target.

ownerInformation string

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType string

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets MaintenanceWindowTargetTargetArgs[]

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId string

The Id of the maintenance window to register the target with.

description str

The description of the maintenance window target.

name str

The name of the maintenance window target.

owner_information str

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resource_type str

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets Sequence[MaintenanceWindowTargetTargetArgs]

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

window_id str

The Id of the maintenance window to register the target with.

description String

The description of the maintenance window target.

name String

The name of the maintenance window target.

ownerInformation String

User-provided value that will be included in any CloudWatch events raised while running tasks for these targets in this Maintenance Window.

resourceType String

The type of target being registered with the Maintenance Window. Possible values are INSTANCE and RESOURCE_GROUP.

targets List<Property Map>

The targets to register with the maintenance window. In other words, the instances to run commands on when the maintenance window runs. You can specify targets using instance IDs, resource group names, or tags that have been applied to instances. For more information about these examples formats see (https://docs.aws.amazon.com/systems-manager/latest/userguide/mw-cli-tutorial-targets-examples.html)

windowId String

The Id of the maintenance window to register the target with.

Supporting Types

MaintenanceWindowTargetTarget

Key string
Values List<string>
Key string
Values []string
key String
values List<String>
key string
values string[]
key str
values Sequence[str]
key String
values List<String>

Import

SSM Maintenance Window targets can be imported using WINDOW_ID/WINDOW_TARGET_ID, e.g.,

 $ pulumi import aws:ssm/maintenanceWindowTarget:MaintenanceWindowTarget example mw-0c50858d01EXAMPLE/23639a0b-ddbc-4bca-9e72-78d96EXAMPLE

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.