Show / Hide Table of Contents

Class MaintenanceWindowTask

Provides an SSM Maintenance Window Task resource

Example Usage

Automation Tasks

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Ssm.MaintenanceWindowTask("example", new Aws.Ssm.MaintenanceWindowTaskArgs
    {
        MaxConcurrency = 2,
        MaxErrors = 1,
        Priority = 1,
        ServiceRoleArn = aws_iam_role.Example.Arn,
        Targets = 
        {
            new Aws.Ssm.Inputs.MaintenanceWindowTaskTargetArgs
            {
                Key = "InstanceIds",
                Values = 
                {
                    aws_instance.Example.Id,
                },
            },
        },
        TaskArn = "AWS-RestartEC2Instance",
        TaskInvocationParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersArgs
        {
            AutomationParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersAutomationParametersArgs
            {
                DocumentVersion = "$$LATEST",
                Parameter = 
                {

                    {
                        { "name", "InstanceId" },
                        { "values", 
                        {
                            aws_instance.Example.Id,
                        } },
                    },
                },
            },
        },
        TaskType = "AUTOMATION",
        WindowId = aws_ssm_maintenance_window.Example.Id,
    });
}

}

Run Command Tasks

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Ssm.MaintenanceWindowTask("example", new Aws.Ssm.MaintenanceWindowTaskArgs
    {
        MaxConcurrency = 2,
        MaxErrors = 1,
        Priority = 1,
        ServiceRoleArn = aws_iam_role.Example.Arn,
        Targets = 
        {
            new Aws.Ssm.Inputs.MaintenanceWindowTaskTargetArgs
            {
                Key = "InstanceIds",
                Values = 
                {
                    aws_instance.Example.Id,
                },
            },
        },
        TaskArn = "AWS-RunShellScript",
        TaskInvocationParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersArgs
        {
            RunCommandParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersRunCommandParametersArgs
            {
                NotificationConfig = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersRunCommandParametersNotificationConfigArgs
                {
                    NotificationArn = aws_sns_topic.Example.Arn,
                    NotificationEvents = 
                    {
                        "All",
                    },
                    NotificationType = "Command",
                },
                OutputS3Bucket = aws_s3_bucket.Example.Bucket,
                OutputS3KeyPrefix = "output",
                Parameter = 
                {

                    {
                        { "name", "commands" },
                        { "values", 
                        {
                            "date",
                        } },
                    },
                },
                ServiceRoleArn = aws_iam_role.Example.Arn,
                TimeoutSeconds = 600,
            },
        },
        TaskType = "RUN_COMMAND",
        WindowId = aws_ssm_maintenance_window.Example.Id,
    });
}

}

Step Function Tasks

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Ssm.MaintenanceWindowTask("example", new Aws.Ssm.MaintenanceWindowTaskArgs
    {
        MaxConcurrency = 2,
        MaxErrors = 1,
        Priority = 1,
        ServiceRoleArn = aws_iam_role.Example.Arn,
        Targets = 
        {
            new Aws.Ssm.Inputs.MaintenanceWindowTaskTargetArgs
            {
                Key = "InstanceIds",
                Values = 
                {
                    aws_instance.Example.Id,
                },
            },
        },
        TaskArn = aws_sfn_activity.Example.Id,
        TaskInvocationParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersArgs
        {
            StepFunctionsParameters = new Aws.Ssm.Inputs.MaintenanceWindowTaskTaskInvocationParametersStepFunctionsParametersArgs
            {
                Input = "{\"key1\":\"value1\"}",
                Name = "example",
            },
        },
        TaskType = "STEP_FUNCTIONS",
        WindowId = aws_ssm_maintenance_window.Example.Id,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
MaintenanceWindowTask
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ssm
Assembly: Pulumi.Aws.dll
Syntax
public class MaintenanceWindowTask : CustomResource

Constructors

View Source

MaintenanceWindowTask(String, MaintenanceWindowTaskArgs, CustomResourceOptions)

Create a MaintenanceWindowTask resource with the given unique name, arguments, and options.

Declaration
public MaintenanceWindowTask(string name, MaintenanceWindowTaskArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

MaintenanceWindowTaskArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Description

The description of the maintenance window task.

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

LoggingInfo

A structure containing information about an Amazon S3 bucket to write instance-level logs to. Use task_invocation_parameters configuration block run_command_parameters configuration block output_s3_* arguments instead. Conflicts with task_invocation_parameters. Documented below.

Declaration
public Output<MaintenanceWindowTaskLoggingInfo> LoggingInfo { get; }
Property Value
Type Description
Output<MaintenanceWindowTaskLoggingInfo>
View Source

MaxConcurrency

The maximum number of targets this task can be run for in parallel.

Declaration
public Output<string> MaxConcurrency { get; }
Property Value
Type Description
Output<System.String>
View Source

MaxErrors

The maximum number of errors allowed before this task stops being scheduled.

Declaration
public Output<string> MaxErrors { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name of the maintenance window task.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Priority

The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.

Declaration
public Output<int?> Priority { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

ServiceRoleArn

The role that should be assumed when executing the task.

Declaration
public Output<string> ServiceRoleArn { get; }
Property Value
Type Description
Output<System.String>
View Source

Targets

The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.

Declaration
public Output<ImmutableArray<MaintenanceWindowTaskTarget>> Targets { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<MaintenanceWindowTaskTarget>>
View Source

TaskArn

The ARN of the task to execute.

Declaration
public Output<string> TaskArn { get; }
Property Value
Type Description
Output<System.String>
View Source

TaskInvocationParameters

The parameters for task execution. This argument is conflict with task_parameters and logging_info.

Declaration
public Output<MaintenanceWindowTaskTaskInvocationParameters> TaskInvocationParameters { get; }
Property Value
Type Description
Output<MaintenanceWindowTaskTaskInvocationParameters>
View Source

TaskParameters

A structure containing information about parameters required by the particular task_arn. Use parameter configuration blocks under the task_invocation_parameters configuration block instead. Conflicts with task_invocation_parameters. Documented below.

Declaration
public Output<ImmutableArray<MaintenanceWindowTaskTaskParameter>> TaskParameters { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<MaintenanceWindowTaskTaskParameter>>
View Source

TaskType

The type of task being registered. The only allowed value is RUN_COMMAND.

Declaration
public Output<string> TaskType { get; }
Property Value
Type Description
Output<System.String>
View Source

WindowId

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

Declaration
public Output<string> WindowId { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, MaintenanceWindowTaskState, CustomResourceOptions)

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

Declaration
public static MaintenanceWindowTask Get(string name, Input<string> id, MaintenanceWindowTaskState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

MaintenanceWindowTaskState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
MaintenanceWindowTask
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.