1. Packages
  2. AWS
  3. API Docs
  4. ssm
  5. Association
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

aws.ssm.Association

Explore with Pulumi AI

aws logo
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

    Associates an SSM Document to an instance or EC2 tag.

    Example Usage

    Create an association for a specific instance

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ssm.Association("example", {
        name: exampleAwsSsmDocument.name,
        targets: [{
            key: "InstanceIds",
            values: [exampleAwsInstance.id],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ssm.Association("example",
        name=example_aws_ssm_document["name"],
        targets=[{
            "key": "InstanceIds",
            "values": [example_aws_instance["id"]],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ssm.NewAssociation(ctx, "example", &ssm.AssociationArgs{
    			Name: pulumi.Any(exampleAwsSsmDocument.Name),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("InstanceIds"),
    					Values: pulumi.StringArray{
    						exampleAwsInstance.Id,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Ssm.Association("example", new()
        {
            Name = exampleAwsSsmDocument.Name,
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "InstanceIds",
                    Values = new[]
                    {
                        exampleAwsInstance.Id,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    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 example = new Association("example", AssociationArgs.builder()
                .name(exampleAwsSsmDocument.name())
                .targets(AssociationTargetArgs.builder()
                    .key("InstanceIds")
                    .values(exampleAwsInstance.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ssm:Association
        properties:
          name: ${exampleAwsSsmDocument.name}
          targets:
            - key: InstanceIds
              values:
                - ${exampleAwsInstance.id}
    

    Create an association for all managed instances in an AWS account

    To target all managed instances in an AWS account, set the key as "InstanceIds" with values set as ["*"]. This example also illustrates how to use an Amazon owned SSM document named AmazonCloudWatch-ManageAgent.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ssm.Association("example", {
        name: "AmazonCloudWatch-ManageAgent",
        targets: [{
            key: "InstanceIds",
            values: ["*"],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ssm.Association("example",
        name="AmazonCloudWatch-ManageAgent",
        targets=[{
            "key": "InstanceIds",
            "values": ["*"],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ssm.NewAssociation(ctx, "example", &ssm.AssociationArgs{
    			Name: pulumi.String("AmazonCloudWatch-ManageAgent"),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("InstanceIds"),
    					Values: pulumi.StringArray{
    						pulumi.String("*"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Ssm.Association("example", new()
        {
            Name = "AmazonCloudWatch-ManageAgent",
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "InstanceIds",
                    Values = new[]
                    {
                        "*",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    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 example = new Association("example", AssociationArgs.builder()
                .name("AmazonCloudWatch-ManageAgent")
                .targets(AssociationTargetArgs.builder()
                    .key("InstanceIds")
                    .values("*")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ssm:Association
        properties:
          name: AmazonCloudWatch-ManageAgent
          targets:
            - key: InstanceIds
              values:
                - '*'
    

    Create an association for a specific tag

    This example shows how to target all managed instances that are assigned a tag key of Environment and value of Development.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ssm.Association("example", {
        name: "AmazonCloudWatch-ManageAgent",
        targets: [{
            key: "tag:Environment",
            values: ["Development"],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ssm.Association("example",
        name="AmazonCloudWatch-ManageAgent",
        targets=[{
            "key": "tag:Environment",
            "values": ["Development"],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ssm.NewAssociation(ctx, "example", &ssm.AssociationArgs{
    			Name: pulumi.String("AmazonCloudWatch-ManageAgent"),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("tag:Environment"),
    					Values: pulumi.StringArray{
    						pulumi.String("Development"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Ssm.Association("example", new()
        {
            Name = "AmazonCloudWatch-ManageAgent",
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "tag:Environment",
                    Values = new[]
                    {
                        "Development",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    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 example = new Association("example", AssociationArgs.builder()
                .name("AmazonCloudWatch-ManageAgent")
                .targets(AssociationTargetArgs.builder()
                    .key("tag:Environment")
                    .values("Development")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ssm:Association
        properties:
          name: AmazonCloudWatch-ManageAgent
          targets:
            - key: tag:Environment
              values:
                - Development
    

    Create an association with a specific schedule

    This example shows how to schedule an association in various ways.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ssm.Association("example", {
        name: exampleAwsSsmDocument.name,
        scheduleExpression: "cron(0 2 ? * SUN *)",
        targets: [{
            key: "InstanceIds",
            values: [exampleAwsInstance.id],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ssm.Association("example",
        name=example_aws_ssm_document["name"],
        schedule_expression="cron(0 2 ? * SUN *)",
        targets=[{
            "key": "InstanceIds",
            "values": [example_aws_instance["id"]],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ssm.NewAssociation(ctx, "example", &ssm.AssociationArgs{
    			Name:               pulumi.Any(exampleAwsSsmDocument.Name),
    			ScheduleExpression: pulumi.String("cron(0 2 ? * SUN *)"),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("InstanceIds"),
    					Values: pulumi.StringArray{
    						exampleAwsInstance.Id,
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Ssm.Association("example", new()
        {
            Name = exampleAwsSsmDocument.Name,
            ScheduleExpression = "cron(0 2 ? * SUN *)",
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "InstanceIds",
                    Values = new[]
                    {
                        exampleAwsInstance.Id,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    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 example = new Association("example", AssociationArgs.builder()
                .name(exampleAwsSsmDocument.name())
                .scheduleExpression("cron(0 2 ? * SUN *)")
                .targets(AssociationTargetArgs.builder()
                    .key("InstanceIds")
                    .values(exampleAwsInstance.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ssm:Association
        properties:
          name: ${exampleAwsSsmDocument.name}
          scheduleExpression: cron(0 2 ? * SUN *)
          targets:
            - key: InstanceIds
              values:
                - ${exampleAwsInstance.id}
    

    Create an association with multiple instances with their instance ids

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    // First EC2 instance
    const webServer1 = new aws.ec2.Instance("web_server_1", {
        ami: amazonLinux.id,
        instanceType: aws.ec2.InstanceType.T3_Micro,
        subnetId: _public.id,
        vpcSecurityGroupIds: [ec2Sg.id],
        iamInstanceProfile: ec2SsmProfile.name,
        userData: `#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    `,
    });
    // Second EC2 instance
    const webServer2 = new aws.ec2.Instance("web_server_2", {
        ami: amazonLinux.id,
        instanceType: aws.ec2.InstanceType.T3_Micro,
        subnetId: _public.id,
        vpcSecurityGroupIds: [ec2Sg.id],
        iamInstanceProfile: ec2SsmProfile.name,
        userData: `#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    `,
    });
    // Removed EC2 provisioning dependencies for brevity
    const systemUpdate = new aws.ssm.Association("system_update", {
        name: "AWS-RunShellScript",
        targets: [{
            key: "InstanceIds",
            values: [
                webServer1.id,
                webServer2.id,
            ],
        }],
        scheduleExpression: "cron(0 2 ? * SUN *)",
        parameters: {
            commands: std.join({
                separator: "\n",
                input: [
                    "#!/bin/bash",
                    "echo 'Starting system update on $(hostname)'",
                    "echo 'Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'",
                    "yum update -y",
                    "echo 'System update completed successfully'",
                    "systemctl status httpd",
                    "df -h",
                    "free -m",
                ],
            }).then(invoke => invoke.result),
            workingDirectory: "/tmp",
            executionTimeout: "3600",
        },
        associationName: "weekly-system-update",
        complianceSeverity: "MEDIUM",
        maxConcurrency: "1",
        maxErrors: "0",
        tags: {
            Name: "Weekly System Update",
            Environment: "demo",
            Purpose: "maintenance",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    # First EC2 instance
    web_server1 = aws.ec2.Instance("web_server_1",
        ami=amazon_linux["id"],
        instance_type=aws.ec2.InstanceType.T3_MICRO,
        subnet_id=public["id"],
        vpc_security_group_ids=[ec2_sg["id"]],
        iam_instance_profile=ec2_ssm_profile["name"],
        user_data="""#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    """)
    # Second EC2 instance
    web_server2 = aws.ec2.Instance("web_server_2",
        ami=amazon_linux["id"],
        instance_type=aws.ec2.InstanceType.T3_MICRO,
        subnet_id=public["id"],
        vpc_security_group_ids=[ec2_sg["id"]],
        iam_instance_profile=ec2_ssm_profile["name"],
        user_data="""#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    """)
    # Removed EC2 provisioning dependencies for brevity
    system_update = aws.ssm.Association("system_update",
        name="AWS-RunShellScript",
        targets=[{
            "key": "InstanceIds",
            "values": [
                web_server1.id,
                web_server2.id,
            ],
        }],
        schedule_expression="cron(0 2 ? * SUN *)",
        parameters={
            "commands": std.join(separator="\n",
                input=[
                    "#!/bin/bash",
                    "echo 'Starting system update on $(hostname)'",
                    "echo 'Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'",
                    "yum update -y",
                    "echo 'System update completed successfully'",
                    "systemctl status httpd",
                    "df -h",
                    "free -m",
                ]).result,
            "workingDirectory": "/tmp",
            "executionTimeout": "3600",
        },
        association_name="weekly-system-update",
        compliance_severity="MEDIUM",
        max_concurrency="1",
        max_errors="0",
        tags={
            "Name": "Weekly System Update",
            "Environment": "demo",
            "Purpose": "maintenance",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// First EC2 instance
    		webServer1, err := ec2.NewInstance(ctx, "web_server_1", &ec2.InstanceArgs{
    			Ami:          pulumi.Any(amazonLinux.Id),
    			InstanceType: pulumi.String(ec2.InstanceType_T3_Micro),
    			SubnetId:     pulumi.Any(public.Id),
    			VpcSecurityGroupIds: pulumi.StringArray{
    				ec2Sg.Id,
    			},
    			IamInstanceProfile: pulumi.Any(ec2SsmProfile.Name),
    			UserData: pulumi.String(`#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    `),
    		})
    		if err != nil {
    			return err
    		}
    		// Second EC2 instance
    		webServer2, err := ec2.NewInstance(ctx, "web_server_2", &ec2.InstanceArgs{
    			Ami:          pulumi.Any(amazonLinux.Id),
    			InstanceType: pulumi.String(ec2.InstanceType_T3_Micro),
    			SubnetId:     pulumi.Any(public.Id),
    			VpcSecurityGroupIds: pulumi.StringArray{
    				ec2Sg.Id,
    			},
    			IamInstanceProfile: pulumi.Any(ec2SsmProfile.Name),
    			UserData: pulumi.String(`#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    `),
    		})
    		if err != nil {
    			return err
    		}
    		invokeJoin, err := std.Join(ctx, &std.JoinArgs{
    			Separator: "\n",
    			Input: []string{
    				"#!/bin/bash",
    				"echo 'Starting system update on $(hostname)'",
    				"echo 'Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'",
    				"yum update -y",
    				"echo 'System update completed successfully'",
    				"systemctl status httpd",
    				"df -h",
    				"free -m",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Removed EC2 provisioning dependencies for brevity
    		_, err = ssm.NewAssociation(ctx, "system_update", &ssm.AssociationArgs{
    			Name: pulumi.String("AWS-RunShellScript"),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("InstanceIds"),
    					Values: pulumi.StringArray{
    						webServer1.ID(),
    						webServer2.ID(),
    					},
    				},
    			},
    			ScheduleExpression: pulumi.String("cron(0 2 ? * SUN *)"),
    			Parameters: pulumi.StringMap{
    				"commands":         pulumi.String(invokeJoin.Result),
    				"workingDirectory": pulumi.String("/tmp"),
    				"executionTimeout": pulumi.String("3600"),
    			},
    			AssociationName:    pulumi.String("weekly-system-update"),
    			ComplianceSeverity: pulumi.String("MEDIUM"),
    			MaxConcurrency:     pulumi.String("1"),
    			MaxErrors:          pulumi.String("0"),
    			Tags: pulumi.StringMap{
    				"Name":        pulumi.String("Weekly System Update"),
    				"Environment": pulumi.String("demo"),
    				"Purpose":     pulumi.String("maintenance"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // First EC2 instance
        var webServer1 = new Aws.Ec2.Instance("web_server_1", new()
        {
            Ami = amazonLinux.Id,
            InstanceType = Aws.Ec2.InstanceType.T3_Micro,
            SubnetId = @public.Id,
            VpcSecurityGroupIds = new[]
            {
                ec2Sg.Id,
            },
            IamInstanceProfile = ec2SsmProfile.Name,
            UserData = @"#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    ",
        });
    
        // Second EC2 instance
        var webServer2 = new Aws.Ec2.Instance("web_server_2", new()
        {
            Ami = amazonLinux.Id,
            InstanceType = Aws.Ec2.InstanceType.T3_Micro,
            SubnetId = @public.Id,
            VpcSecurityGroupIds = new[]
            {
                ec2Sg.Id,
            },
            IamInstanceProfile = ec2SsmProfile.Name,
            UserData = @"#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
    ",
        });
    
        // Removed EC2 provisioning dependencies for brevity
        var systemUpdate = new Aws.Ssm.Association("system_update", new()
        {
            Name = "AWS-RunShellScript",
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "InstanceIds",
                    Values = new[]
                    {
                        webServer1.Id,
                        webServer2.Id,
                    },
                },
            },
            ScheduleExpression = "cron(0 2 ? * SUN *)",
            Parameters = 
            {
                { "commands", Std.Join.Invoke(new()
                {
                    Separator = @"
    ",
                    Input = new[]
                    {
                        "#!/bin/bash",
                        "echo 'Starting system update on $(hostname)'",
                        "echo 'Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'",
                        "yum update -y",
                        "echo 'System update completed successfully'",
                        "systemctl status httpd",
                        "df -h",
                        "free -m",
                    },
                }).Apply(invoke => invoke.Result) },
                { "workingDirectory", "/tmp" },
                { "executionTimeout", "3600" },
            },
            AssociationName = "weekly-system-update",
            ComplianceSeverity = "MEDIUM",
            MaxConcurrency = "1",
            MaxErrors = "0",
            Tags = 
            {
                { "Name", "Weekly System Update" },
                { "Environment", "demo" },
                { "Purpose", "maintenance" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.JoinArgs;
    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) {
            // First EC2 instance
            var webServer1 = new Instance("webServer1", InstanceArgs.builder()
                .ami(amazonLinux.id())
                .instanceType("t3.micro")
                .subnetId(public_.id())
                .vpcSecurityGroupIds(ec2Sg.id())
                .iamInstanceProfile(ec2SsmProfile.name())
                .userData("""
    #!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
                """)
                .build());
    
            // Second EC2 instance
            var webServer2 = new Instance("webServer2", InstanceArgs.builder()
                .ami(amazonLinux.id())
                .instanceType("t3.micro")
                .subnetId(public_.id())
                .vpcSecurityGroupIds(ec2Sg.id())
                .iamInstanceProfile(ec2SsmProfile.name())
                .userData("""
    #!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
                """)
                .build());
    
            // Removed EC2 provisioning dependencies for brevity
            var systemUpdate = new Association("systemUpdate", AssociationArgs.builder()
                .name("AWS-RunShellScript")
                .targets(AssociationTargetArgs.builder()
                    .key("InstanceIds")
                    .values(                
                        webServer1.id(),
                        webServer2.id())
                    .build())
                .scheduleExpression("cron(0 2 ? * SUN *)")
                .parameters(Map.ofEntries(
                    Map.entry("commands", StdFunctions.join(JoinArgs.builder()
                        .separator("""
    
                        """)
                        .input(                    
                            "#!/bin/bash",
                            "echo 'Starting system update on $(hostname)'",
                            "echo 'Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'",
                            "yum update -y",
                            "echo 'System update completed successfully'",
                            "systemctl status httpd",
                            "df -h",
                            "free -m")
                        .build()).result()),
                    Map.entry("workingDirectory", "/tmp"),
                    Map.entry("executionTimeout", "3600")
                ))
                .associationName("weekly-system-update")
                .complianceSeverity("MEDIUM")
                .maxConcurrency("1")
                .maxErrors("0")
                .tags(Map.ofEntries(
                    Map.entry("Name", "Weekly System Update"),
                    Map.entry("Environment", "demo"),
                    Map.entry("Purpose", "maintenance")
                ))
                .build());
    
        }
    }
    
    resources:
      # Removed EC2 provisioning dependencies for brevity
      systemUpdate:
        type: aws:ssm:Association
        name: system_update
        properties:
          name: AWS-RunShellScript
          targets:
            - key: InstanceIds
              values:
                - ${webServer1.id}
                - ${webServer2.id}
          scheduleExpression: cron(0 2 ? * SUN *)
          parameters:
            commands:
              fn::invoke:
                function: std:join
                arguments:
                  separator: |2+
                  input:
                    - '#!/bin/bash'
                    - echo 'Starting system update on $(hostname)'
                    - 'echo ''Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)'''
                    - yum update -y
                    - echo 'System update completed successfully'
                    - systemctl status httpd
                    - df -h
                    - free -m
                return: result
            workingDirectory: /tmp
            executionTimeout: '3600'
          associationName: weekly-system-update
          complianceSeverity: MEDIUM
          maxConcurrency: '1'
          maxErrors: '0'
          tags:
            Name: Weekly System Update
            Environment: demo
            Purpose: maintenance
      # First EC2 instance
      webServer1:
        type: aws:ec2:Instance
        name: web_server_1
        properties:
          ami: ${amazonLinux.id}
          instanceType: t3.micro
          subnetId: ${public.id}
          vpcSecurityGroupIds:
            - ${ec2Sg.id}
          iamInstanceProfile: ${ec2SsmProfile.name}
          userData: |
            #!/bin/bash
            yum update -y
            yum install -y amazon-ssm-agent
            systemctl enable amazon-ssm-agent
            systemctl start amazon-ssm-agent        
      # Second EC2 instance
      webServer2:
        type: aws:ec2:Instance
        name: web_server_2
        properties:
          ami: ${amazonLinux.id}
          instanceType: t3.micro
          subnetId: ${public.id}
          vpcSecurityGroupIds:
            - ${ec2Sg.id}
          iamInstanceProfile: ${ec2SsmProfile.name}
          userData: |
            #!/bin/bash
            yum update -y
            yum install -y amazon-ssm-agent
            systemctl enable amazon-ssm-agent
            systemctl start amazon-ssm-agent        
    

    Create an association with multiple instances with their values matching their tags

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    // SSM Association for Webbased Servers
    const databaseAssociation = new aws.ssm.Association("database_association", {
        name: systemUpdate.name,
        targets: [{
            key: "tag:Role",
            values: [
                "WebServer",
                "Database",
            ],
        }],
        parameters: {
            restartServices: "true",
        },
        scheduleExpression: "cron(0 3 ? * SUN *)",
    });
    // EC2 Instance 1 - Web Server with "ServerType" tag
    const webServer = new aws.ec2.Instance("web_server", {
        ami: amazonLinux.id,
        instanceType: aws.ec2.InstanceType[instanceType],
        subnetId: _default.id,
        vpcSecurityGroupIds: [ec2Sg.id],
        iamInstanceProfile: ec2SsmProfile.name,
        userData: std.base64encode({
            input: `#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install Apache web server
    yum install -y httpd
    systemctl enable httpd
    systemctl start httpd
    echo "<h1>Web Server - ${prefix}</h1>" > /var/www/html/index.html
    `,
        }).then(invoke => invoke.result),
        tags: {
            Name: `${prefix}-web-server`,
            ServerType: "WebServer",
            Role: "WebServer",
            Environment: environment,
            Owner: owner,
        },
    });
    // EC2 Instance 2 - Database Server with "Role" tag
    const databaseServer = new aws.ec2.Instance("database_server", {
        ami: amazonLinux.id,
        instanceType: aws.ec2.InstanceType[instanceType],
        subnetId: _default.id,
        vpcSecurityGroupIds: [ec2Sg.id],
        iamInstanceProfile: ec2SsmProfile.name,
        userData: std.base64encode({
            input: `#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install MySQL
    yum install -y mysql-server
    systemctl enable mysqld
    systemctl start mysqld
    `,
        }).then(invoke => invoke.result),
        tags: {
            Name: `${prefix}-database-server`,
            Role: "Database",
            Environment: environment,
            Owner: owner,
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    # SSM Association for Webbased Servers
    database_association = aws.ssm.Association("database_association",
        name=system_update["name"],
        targets=[{
            "key": "tag:Role",
            "values": [
                "WebServer",
                "Database",
            ],
        }],
        parameters={
            "restartServices": "true",
        },
        schedule_expression="cron(0 3 ? * SUN *)")
    # EC2 Instance 1 - Web Server with "ServerType" tag
    web_server = aws.ec2.Instance("web_server",
        ami=amazon_linux["id"],
        instance_type=aws.ec2.InstanceType(instance_type),
        subnet_id=default["id"],
        vpc_security_group_ids=[ec2_sg["id"]],
        iam_instance_profile=ec2_ssm_profile["name"],
        user_data=std.base64encode(input=f"""#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install Apache web server
    yum install -y httpd
    systemctl enable httpd
    systemctl start httpd
    echo "<h1>Web Server - {prefix}</h1>" > /var/www/html/index.html
    """).result,
        tags={
            "Name": f"{prefix}-web-server",
            "ServerType": "WebServer",
            "Role": "WebServer",
            "Environment": environment,
            "Owner": owner,
        })
    # EC2 Instance 2 - Database Server with "Role" tag
    database_server = aws.ec2.Instance("database_server",
        ami=amazon_linux["id"],
        instance_type=aws.ec2.InstanceType(instance_type),
        subnet_id=default["id"],
        vpc_security_group_ids=[ec2_sg["id"]],
        iam_instance_profile=ec2_ssm_profile["name"],
        user_data=std.base64encode(input="""#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install MySQL
    yum install -y mysql-server
    systemctl enable mysqld
    systemctl start mysqld
    """).result,
        tags={
            "Name": f"{prefix}-database-server",
            "Role": "Database",
            "Environment": environment,
            "Owner": owner,
        })
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// SSM Association for Webbased Servers
    		_, err := ssm.NewAssociation(ctx, "database_association", &ssm.AssociationArgs{
    			Name: pulumi.Any(systemUpdate.Name),
    			Targets: ssm.AssociationTargetArray{
    				&ssm.AssociationTargetArgs{
    					Key: pulumi.String("tag:Role"),
    					Values: pulumi.StringArray{
    						pulumi.String("WebServer"),
    						pulumi.String("Database"),
    					},
    				},
    			},
    			Parameters: pulumi.StringMap{
    				"restartServices": pulumi.String("true"),
    			},
    			ScheduleExpression: pulumi.String("cron(0 3 ? * SUN *)"),
    		})
    		if err != nil {
    			return err
    		}
    		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
    			Input: fmt.Sprintf(`#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install Apache web server
    yum install -y httpd
    systemctl enable httpd
    systemctl start httpd
    echo "<h1>Web Server - %v</h1>" > /var/www/html/index.html
    `, prefix),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// EC2 Instance 1 - Web Server with "ServerType" tag
    		_, err = ec2.NewInstance(ctx, "web_server", &ec2.InstanceArgs{
    			Ami:          pulumi.Any(amazonLinux.Id),
    			InstanceType: ec2.InstanceType(instanceType),
    			SubnetId:     pulumi.Any(_default.Id),
    			VpcSecurityGroupIds: pulumi.StringArray{
    				ec2Sg.Id,
    			},
    			IamInstanceProfile: pulumi.Any(ec2SsmProfile.Name),
    			UserData:           pulumi.String(invokeBase64encode.Result),
    			Tags: pulumi.StringMap{
    				"Name":        pulumi.Sprintf("%v-web-server", prefix),
    				"ServerType":  pulumi.String("WebServer"),
    				"Role":        pulumi.String("WebServer"),
    				"Environment": pulumi.Any(environment),
    				"Owner":       pulumi.Any(owner),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
    			Input: `#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install MySQL
    yum install -y mysql-server
    systemctl enable mysqld
    systemctl start mysqld
    `,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// EC2 Instance 2 - Database Server with "Role" tag
    		_, err = ec2.NewInstance(ctx, "database_server", &ec2.InstanceArgs{
    			Ami:          pulumi.Any(amazonLinux.Id),
    			InstanceType: ec2.InstanceType(instanceType),
    			SubnetId:     pulumi.Any(_default.Id),
    			VpcSecurityGroupIds: pulumi.StringArray{
    				ec2Sg.Id,
    			},
    			IamInstanceProfile: pulumi.Any(ec2SsmProfile.Name),
    			UserData:           pulumi.String(invokeBase64encode1.Result),
    			Tags: pulumi.StringMap{
    				"Name":        pulumi.Sprintf("%v-database-server", prefix),
    				"Role":        pulumi.String("Database"),
    				"Environment": pulumi.Any(environment),
    				"Owner":       pulumi.Any(owner),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // SSM Association for Webbased Servers
        var databaseAssociation = new Aws.Ssm.Association("database_association", new()
        {
            Name = systemUpdate.Name,
            Targets = new[]
            {
                new Aws.Ssm.Inputs.AssociationTargetArgs
                {
                    Key = "tag:Role",
                    Values = new[]
                    {
                        "WebServer",
                        "Database",
                    },
                },
            },
            Parameters = 
            {
                { "restartServices", "true" },
            },
            ScheduleExpression = "cron(0 3 ? * SUN *)",
        });
    
        // EC2 Instance 1 - Web Server with "ServerType" tag
        var webServer = new Aws.Ec2.Instance("web_server", new()
        {
            Ami = amazonLinux.Id,
            InstanceType = System.Enum.Parse<Aws.Ec2.InstanceType>(instanceType),
            SubnetId = @default.Id,
            VpcSecurityGroupIds = new[]
            {
                ec2Sg.Id,
            },
            IamInstanceProfile = ec2SsmProfile.Name,
            UserData = Std.Base64encode.Invoke(new()
            {
                Input = @$"#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install Apache web server
    yum install -y httpd
    systemctl enable httpd
    systemctl start httpd
    echo ""<h1>Web Server - {prefix}</h1>"" > /var/www/html/index.html
    ",
            }).Apply(invoke => invoke.Result),
            Tags = 
            {
                { "Name", $"{prefix}-web-server" },
                { "ServerType", "WebServer" },
                { "Role", "WebServer" },
                { "Environment", environment },
                { "Owner", owner },
            },
        });
    
        // EC2 Instance 2 - Database Server with "Role" tag
        var databaseServer = new Aws.Ec2.Instance("database_server", new()
        {
            Ami = amazonLinux.Id,
            InstanceType = System.Enum.Parse<Aws.Ec2.InstanceType>(instanceType),
            SubnetId = @default.Id,
            VpcSecurityGroupIds = new[]
            {
                ec2Sg.Id,
            },
            IamInstanceProfile = ec2SsmProfile.Name,
            UserData = Std.Base64encode.Invoke(new()
            {
                Input = @"#!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install MySQL
    yum install -y mysql-server
    systemctl enable mysqld
    systemctl start mysqld
    ",
            }).Apply(invoke => invoke.Result),
            Tags = 
            {
                { "Name", $"{prefix}-database-server" },
                { "Role", "Database" },
                { "Environment", environment },
                { "Owner", owner },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.Association;
    import com.pulumi.aws.ssm.AssociationArgs;
    import com.pulumi.aws.ssm.inputs.AssociationTargetArgs;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.Base64encodeArgs;
    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) {
            // SSM Association for Webbased Servers
            var databaseAssociation = new Association("databaseAssociation", AssociationArgs.builder()
                .name(systemUpdate.name())
                .targets(AssociationTargetArgs.builder()
                    .key("tag:Role")
                    .values(                
                        "WebServer",
                        "Database")
                    .build())
                .parameters(Map.of("restartServices", "true"))
                .scheduleExpression("cron(0 3 ? * SUN *)")
                .build());
    
            // EC2 Instance 1 - Web Server with "ServerType" tag
            var webServer = new Instance("webServer", InstanceArgs.builder()
                .ami(amazonLinux.id())
                .instanceType(instanceType)
                .subnetId(default_.id())
                .vpcSecurityGroupIds(ec2Sg.id())
                .iamInstanceProfile(ec2SsmProfile.name())
                .userData(StdFunctions.base64encode(Base64encodeArgs.builder()
                    .input("""
    #!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install Apache web server
    yum install -y httpd
    systemctl enable httpd
    systemctl start httpd
    echo "<h1>Web Server - %s</h1>" > /var/www/html/index.html
    ", prefix))
                    .build()).result())
                .tags(Map.ofEntries(
                    Map.entry("Name", String.format("%s-web-server", prefix)),
                    Map.entry("ServerType", "WebServer"),
                    Map.entry("Role", "WebServer"),
                    Map.entry("Environment", environment),
                    Map.entry("Owner", owner)
                ))
                .build());
    
            // EC2 Instance 2 - Database Server with "Role" tag
            var databaseServer = new Instance("databaseServer", InstanceArgs.builder()
                .ami(amazonLinux.id())
                .instanceType(instanceType)
                .subnetId(default_.id())
                .vpcSecurityGroupIds(ec2Sg.id())
                .iamInstanceProfile(ec2SsmProfile.name())
                .userData(StdFunctions.base64encode(Base64encodeArgs.builder()
                    .input("""
    #!/bin/bash
    yum update -y
    yum install -y amazon-ssm-agent
    systemctl enable amazon-ssm-agent
    systemctl start amazon-ssm-agent
        
    # Install MySQL
    yum install -y mysql-server
    systemctl enable mysqld
    systemctl start mysqld
                    """)
                    .build()).result())
                .tags(Map.ofEntries(
                    Map.entry("Name", String.format("%s-database-server", prefix)),
                    Map.entry("Role", "Database"),
                    Map.entry("Environment", environment),
                    Map.entry("Owner", owner)
                ))
                .build());
    
        }
    }
    
    resources:
      # SSM Association for Webbased Servers
      databaseAssociation:
        type: aws:ssm:Association
        name: database_association
        properties:
          name: ${systemUpdate.name}
          targets:
            - key: tag:Role
              values:
                - WebServer
                - Database
          parameters:
            restartServices: 'true'
          scheduleExpression: cron(0 3 ? * SUN *)
      # EC2 Instance 1 - Web Server with "ServerType" tag
      webServer:
        type: aws:ec2:Instance
        name: web_server
        properties:
          ami: ${amazonLinux.id}
          instanceType: ${instanceType}
          subnetId: ${default.id}
          vpcSecurityGroupIds:
            - ${ec2Sg.id}
          iamInstanceProfile: ${ec2SsmProfile.name}
          userData:
            fn::invoke:
              function: std:base64encode
              arguments:
                input: "#!/bin/bash\nyum update -y\nyum install -y amazon-ssm-agent\nsystemctl enable amazon-ssm-agent\nsystemctl start amazon-ssm-agent\n    \n# Install Apache web server\nyum install -y httpd\nsystemctl enable httpd\nsystemctl start httpd\necho \"<h1>Web Server - ${prefix}</h1>\" > /var/www/html/index.html\n"
              return: result
          tags:
            Name: ${prefix}-web-server
            ServerType: WebServer
            Role: WebServer
            Environment: ${environment}
            Owner: ${owner}
      # EC2 Instance 2 - Database Server with "Role" tag
      databaseServer:
        type: aws:ec2:Instance
        name: database_server
        properties:
          ami: ${amazonLinux.id}
          instanceType: ${instanceType}
          subnetId: ${default.id}
          vpcSecurityGroupIds:
            - ${ec2Sg.id}
          iamInstanceProfile: ${ec2SsmProfile.name}
          userData:
            fn::invoke:
              function: std:base64encode
              arguments:
                input: "#!/bin/bash\nyum update -y\nyum install -y amazon-ssm-agent\nsystemctl enable amazon-ssm-agent\nsystemctl start amazon-ssm-agent\n    \n# Install MySQL\nyum install -y mysql-server\nsystemctl enable mysqld\nsystemctl start mysqld\n"
              return: result
          tags:
            Name: ${prefix}-database-server
            Role: Database
            Environment: ${environment}
            Owner: ${owner}
    

    Create Association Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Association(name: string, args?: AssociationArgs, opts?: CustomResourceOptions);
    @overload
    def Association(resource_name: str,
                    args: Optional[AssociationArgs] = None,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def Association(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    apply_only_at_cron_interval: Optional[bool] = None,
                    association_name: Optional[str] = None,
                    automation_target_parameter_name: Optional[str] = None,
                    compliance_severity: Optional[str] = None,
                    document_version: Optional[str] = None,
                    instance_id: Optional[str] = None,
                    max_concurrency: Optional[str] = None,
                    max_errors: Optional[str] = None,
                    name: Optional[str] = None,
                    output_location: Optional[AssociationOutputLocationArgs] = None,
                    parameters: Optional[Mapping[str, str]] = None,
                    schedule_expression: Optional[str] = None,
                    sync_compliance: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    targets: Optional[Sequence[AssociationTargetArgs]] = None,
                    wait_for_success_timeout_seconds: Optional[int] = None)
    func NewAssociation(ctx *Context, name string, args *AssociationArgs, opts ...ResourceOption) (*Association, error)
    public Association(string name, AssociationArgs? args = null, CustomResourceOptions? opts = null)
    public Association(String name, AssociationArgs args)
    public Association(String name, AssociationArgs args, CustomResourceOptions options)
    
    type: aws:ssm:Association
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AssociationArgs
    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 AssociationArgs
    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 AssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var awsAssociationResource = new Aws.Ssm.Association("awsAssociationResource", new()
    {
        ApplyOnlyAtCronInterval = false,
        AssociationName = "string",
        AutomationTargetParameterName = "string",
        ComplianceSeverity = "string",
        DocumentVersion = "string",
        MaxConcurrency = "string",
        MaxErrors = "string",
        Name = "string",
        OutputLocation = new Aws.Ssm.Inputs.AssociationOutputLocationArgs
        {
            S3BucketName = "string",
            S3KeyPrefix = "string",
            S3Region = "string",
        },
        Parameters = 
        {
            { "string", "string" },
        },
        ScheduleExpression = "string",
        SyncCompliance = "string",
        Tags = 
        {
            { "string", "string" },
        },
        Targets = new[]
        {
            new Aws.Ssm.Inputs.AssociationTargetArgs
            {
                Key = "string",
                Values = new[]
                {
                    "string",
                },
            },
        },
        WaitForSuccessTimeoutSeconds = 0,
    });
    
    example, err := ssm.NewAssociation(ctx, "awsAssociationResource", &ssm.AssociationArgs{
    	ApplyOnlyAtCronInterval:       pulumi.Bool(false),
    	AssociationName:               pulumi.String("string"),
    	AutomationTargetParameterName: pulumi.String("string"),
    	ComplianceSeverity:            pulumi.String("string"),
    	DocumentVersion:               pulumi.String("string"),
    	MaxConcurrency:                pulumi.String("string"),
    	MaxErrors:                     pulumi.String("string"),
    	Name:                          pulumi.String("string"),
    	OutputLocation: &ssm.AssociationOutputLocationArgs{
    		S3BucketName: pulumi.String("string"),
    		S3KeyPrefix:  pulumi.String("string"),
    		S3Region:     pulumi.String("string"),
    	},
    	Parameters: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	ScheduleExpression: pulumi.String("string"),
    	SyncCompliance:     pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Targets: ssm.AssociationTargetArray{
    		&ssm.AssociationTargetArgs{
    			Key: pulumi.String("string"),
    			Values: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    	WaitForSuccessTimeoutSeconds: pulumi.Int(0),
    })
    
    var awsAssociationResource = new com.pulumi.aws.ssm.Association("awsAssociationResource", com.pulumi.aws.ssm.AssociationArgs.builder()
        .applyOnlyAtCronInterval(false)
        .associationName("string")
        .automationTargetParameterName("string")
        .complianceSeverity("string")
        .documentVersion("string")
        .maxConcurrency("string")
        .maxErrors("string")
        .name("string")
        .outputLocation(AssociationOutputLocationArgs.builder()
            .s3BucketName("string")
            .s3KeyPrefix("string")
            .s3Region("string")
            .build())
        .parameters(Map.of("string", "string"))
        .scheduleExpression("string")
        .syncCompliance("string")
        .tags(Map.of("string", "string"))
        .targets(AssociationTargetArgs.builder()
            .key("string")
            .values("string")
            .build())
        .waitForSuccessTimeoutSeconds(0)
        .build());
    
    aws_association_resource = aws.ssm.Association("awsAssociationResource",
        apply_only_at_cron_interval=False,
        association_name="string",
        automation_target_parameter_name="string",
        compliance_severity="string",
        document_version="string",
        max_concurrency="string",
        max_errors="string",
        name="string",
        output_location={
            "s3_bucket_name": "string",
            "s3_key_prefix": "string",
            "s3_region": "string",
        },
        parameters={
            "string": "string",
        },
        schedule_expression="string",
        sync_compliance="string",
        tags={
            "string": "string",
        },
        targets=[{
            "key": "string",
            "values": ["string"],
        }],
        wait_for_success_timeout_seconds=0)
    
    const awsAssociationResource = new aws.ssm.Association("awsAssociationResource", {
        applyOnlyAtCronInterval: false,
        associationName: "string",
        automationTargetParameterName: "string",
        complianceSeverity: "string",
        documentVersion: "string",
        maxConcurrency: "string",
        maxErrors: "string",
        name: "string",
        outputLocation: {
            s3BucketName: "string",
            s3KeyPrefix: "string",
            s3Region: "string",
        },
        parameters: {
            string: "string",
        },
        scheduleExpression: "string",
        syncCompliance: "string",
        tags: {
            string: "string",
        },
        targets: [{
            key: "string",
            values: ["string"],
        }],
        waitForSuccessTimeoutSeconds: 0,
    });
    
    type: aws:ssm:Association
    properties:
        applyOnlyAtCronInterval: false
        associationName: string
        automationTargetParameterName: string
        complianceSeverity: string
        documentVersion: string
        maxConcurrency: string
        maxErrors: string
        name: string
        outputLocation:
            s3BucketName: string
            s3KeyPrefix: string
            s3Region: string
        parameters:
            string: string
        scheduleExpression: string
        syncCompliance: string
        tags:
            string: string
        targets:
            - key: string
              values:
                - string
        waitForSuccessTimeoutSeconds: 0
    

    Association Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Association resource accepts the following input properties:

    ApplyOnlyAtCronInterval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    AssociationName string
    The descriptive name for the association.
    AutomationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    ComplianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    DocumentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    InstanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    MaxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    MaxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    Name string
    The name of the SSM document to apply.
    OutputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    Parameters Dictionary<string, string>
    A block of arbitrary string parameters to pass to the SSM document.
    ScheduleExpression string
    A cron or rate expression that specifies when the association runs.
    SyncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    Tags Dictionary<string, string>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    Targets List<AssociationTarget>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    WaitForSuccessTimeoutSeconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    ApplyOnlyAtCronInterval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    AssociationName string
    The descriptive name for the association.
    AutomationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    ComplianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    DocumentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    InstanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    MaxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    MaxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    Name string
    The name of the SSM document to apply.
    OutputLocation AssociationOutputLocationArgs
    An output location block. Output Location is documented below.
    Parameters map[string]string
    A block of arbitrary string parameters to pass to the SSM document.
    ScheduleExpression string
    A cron or rate expression that specifies when the association runs.
    SyncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    Tags map[string]string
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    Targets []AssociationTargetArgs
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    WaitForSuccessTimeoutSeconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval Boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    associationName String
    The descriptive name for the association.
    automationTargetParameterName String
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity String
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion String
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId String
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency String
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors String
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name String
    The name of the SSM document to apply.
    outputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    parameters Map<String,String>
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression String
    A cron or rate expression that specifies when the association runs.
    syncCompliance String
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Map<String,String>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    targets List<AssociationTarget>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds Integer

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    associationName string
    The descriptive name for the association.
    automationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name string
    The name of the SSM document to apply.
    outputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    parameters {[key: string]: string}
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression string
    A cron or rate expression that specifies when the association runs.
    syncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags {[key: string]: string}
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    targets AssociationTarget[]
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds number

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    apply_only_at_cron_interval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    association_name str
    The descriptive name for the association.
    automation_target_parameter_name str
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    compliance_severity str
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    document_version str
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instance_id str
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    max_concurrency str
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    max_errors str
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name str
    The name of the SSM document to apply.
    output_location AssociationOutputLocationArgs
    An output location block. Output Location is documented below.
    parameters Mapping[str, str]
    A block of arbitrary string parameters to pass to the SSM document.
    schedule_expression str
    A cron or rate expression that specifies when the association runs.
    sync_compliance str
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Mapping[str, str]
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    targets Sequence[AssociationTargetArgs]
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    wait_for_success_timeout_seconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval Boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    associationName String
    The descriptive name for the association.
    automationTargetParameterName String
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity String
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion String
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId String
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency String
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors String
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name String
    The name of the SSM document to apply.
    outputLocation Property Map
    An output location block. Output Location is documented below.
    parameters Map<String>
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression String
    A cron or rate expression that specifies when the association runs.
    syncCompliance String
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Map<String>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    targets List<Property Map>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds Number

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    Outputs

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

    Arn string
    The ARN of the SSM association
    AssociationId string
    The ID of the SSM association.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    The ARN of the SSM association
    AssociationId string
    The ID of the SSM association.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the SSM association
    associationId String
    The ID of the SSM association.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    The ARN of the SSM association
    associationId string
    The ID of the SSM association.
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    The ARN of the SSM association
    association_id str
    The ID of the SSM association.
    id str
    The provider-assigned unique ID for this managed resource.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    The ARN of the SSM association
    associationId String
    The ID of the SSM association.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing Association Resource

    Get an existing Association 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?: AssociationState, opts?: CustomResourceOptions): Association
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            apply_only_at_cron_interval: Optional[bool] = None,
            arn: Optional[str] = None,
            association_id: Optional[str] = None,
            association_name: Optional[str] = None,
            automation_target_parameter_name: Optional[str] = None,
            compliance_severity: Optional[str] = None,
            document_version: Optional[str] = None,
            instance_id: Optional[str] = None,
            max_concurrency: Optional[str] = None,
            max_errors: Optional[str] = None,
            name: Optional[str] = None,
            output_location: Optional[AssociationOutputLocationArgs] = None,
            parameters: Optional[Mapping[str, str]] = None,
            schedule_expression: Optional[str] = None,
            sync_compliance: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None,
            targets: Optional[Sequence[AssociationTargetArgs]] = None,
            wait_for_success_timeout_seconds: Optional[int] = None) -> Association
    func GetAssociation(ctx *Context, name string, id IDInput, state *AssociationState, opts ...ResourceOption) (*Association, error)
    public static Association Get(string name, Input<string> id, AssociationState? state, CustomResourceOptions? opts = null)
    public static Association get(String name, Output<String> id, AssociationState state, CustomResourceOptions options)
    resources:  _:    type: aws:ssm:Association    get:      id: ${id}
    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:
    ApplyOnlyAtCronInterval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    Arn string
    The ARN of the SSM association
    AssociationId string
    The ID of the SSM association.
    AssociationName string
    The descriptive name for the association.
    AutomationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    ComplianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    DocumentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    InstanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    MaxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    MaxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    Name string
    The name of the SSM document to apply.
    OutputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    Parameters Dictionary<string, string>
    A block of arbitrary string parameters to pass to the SSM document.
    ScheduleExpression string
    A cron or rate expression that specifies when the association runs.
    SyncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    Tags Dictionary<string, string>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Targets List<AssociationTarget>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    WaitForSuccessTimeoutSeconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    ApplyOnlyAtCronInterval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    Arn string
    The ARN of the SSM association
    AssociationId string
    The ID of the SSM association.
    AssociationName string
    The descriptive name for the association.
    AutomationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    ComplianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    DocumentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    InstanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    MaxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    MaxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    Name string
    The name of the SSM document to apply.
    OutputLocation AssociationOutputLocationArgs
    An output location block. Output Location is documented below.
    Parameters map[string]string
    A block of arbitrary string parameters to pass to the SSM document.
    ScheduleExpression string
    A cron or rate expression that specifies when the association runs.
    SyncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    Tags map[string]string
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Targets []AssociationTargetArgs
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    WaitForSuccessTimeoutSeconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval Boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    arn String
    The ARN of the SSM association
    associationId String
    The ID of the SSM association.
    associationName String
    The descriptive name for the association.
    automationTargetParameterName String
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity String
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion String
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId String
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency String
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors String
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name String
    The name of the SSM document to apply.
    outputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    parameters Map<String,String>
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression String
    A cron or rate expression that specifies when the association runs.
    syncCompliance String
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Map<String,String>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    targets List<AssociationTarget>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds Integer

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    arn string
    The ARN of the SSM association
    associationId string
    The ID of the SSM association.
    associationName string
    The descriptive name for the association.
    automationTargetParameterName string
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity string
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion string
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId string
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency string
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors string
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name string
    The name of the SSM document to apply.
    outputLocation AssociationOutputLocation
    An output location block. Output Location is documented below.
    parameters {[key: string]: string}
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression string
    A cron or rate expression that specifies when the association runs.
    syncCompliance string
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags {[key: string]: string}
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    targets AssociationTarget[]
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds number

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    apply_only_at_cron_interval bool
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    arn str
    The ARN of the SSM association
    association_id str
    The ID of the SSM association.
    association_name str
    The descriptive name for the association.
    automation_target_parameter_name str
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    compliance_severity str
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    document_version str
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instance_id str
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    max_concurrency str
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    max_errors str
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name str
    The name of the SSM document to apply.
    output_location AssociationOutputLocationArgs
    An output location block. Output Location is documented below.
    parameters Mapping[str, str]
    A block of arbitrary string parameters to pass to the SSM document.
    schedule_expression str
    A cron or rate expression that specifies when the association runs.
    sync_compliance str
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Mapping[str, str]
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    targets Sequence[AssociationTargetArgs]
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    wait_for_success_timeout_seconds int

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    applyOnlyAtCronInterval Boolean
    By default, when you create a new or update associations, the system runs it immediately and then according to the schedule you specified. Enable this option if you do not want an association to run immediately after you create or update it. This parameter is not supported for rate expressions. Default: false.
    arn String
    The ARN of the SSM association
    associationId String
    The ID of the SSM association.
    associationName String
    The descriptive name for the association.
    automationTargetParameterName String
    Specify the target for the association. This target is required for associations that use an Automation document and target resources by using rate controls. This should be set to the SSM document parameter that will define how your automation will branch out.
    complianceSeverity String
    The compliance severity for the association. Can be one of the following: UNSPECIFIED, LOW, MEDIUM, HIGH or CRITICAL
    documentVersion String
    The document version you want to associate with the target(s). Can be a specific version or the default version.
    instanceId String
    The instance ID to apply an SSM document to. Use targets with key InstanceIds for document schema versions 2.0 and above. Use the targets attribute instead.

    Deprecated: instance_id is deprecated. Use targets instead.

    maxConcurrency String
    The maximum number of targets allowed to run the association at the same time. You can specify a number, for example 10, or a percentage of the target set, for example 10%.
    maxErrors String
    The number of errors that are allowed before the system stops sending requests to run the association on additional targets. You can specify a number, for example 10, or a percentage of the target set, for example 10%. If you specify a threshold of 3, the stop command is sent when the fourth error is returned. If you specify a threshold of 10% for 50 associations, the stop command is sent when the sixth error is returned.
    name String
    The name of the SSM document to apply.
    outputLocation Property Map
    An output location block. Output Location is documented below.
    parameters Map<String>
    A block of arbitrary string parameters to pass to the SSM document.
    scheduleExpression String
    A cron or rate expression that specifies when the association runs.
    syncCompliance String
    The mode for generating association compliance. You can specify AUTO or MANUAL.
    tags Map<String>
    A map of tags to assign to the object. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    targets List<Property Map>
    A block containing the targets of the SSM association. Targets are documented below. AWS currently supports a maximum of 5 targets.
    waitForSuccessTimeoutSeconds Number

    The number of seconds to wait for the association status to be Success. If Success status is not reached within the given time, create opration will fail.

    Output Location (output_location) is an S3 bucket where you want to store the results of this association:

    Supporting Types

    AssociationOutputLocation, AssociationOutputLocationArgs

    S3BucketName string
    The S3 bucket name.
    S3KeyPrefix string
    The S3 bucket prefix. Results stored in the root if not configured.
    S3Region string

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    S3BucketName string
    The S3 bucket name.
    S3KeyPrefix string
    The S3 bucket prefix. Results stored in the root if not configured.
    S3Region string

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    s3BucketName String
    The S3 bucket name.
    s3KeyPrefix String
    The S3 bucket prefix. Results stored in the root if not configured.
    s3Region String

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    s3BucketName string
    The S3 bucket name.
    s3KeyPrefix string
    The S3 bucket prefix. Results stored in the root if not configured.
    s3Region string

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    s3_bucket_name str
    The S3 bucket name.
    s3_key_prefix str
    The S3 bucket prefix. Results stored in the root if not configured.
    s3_region str

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    s3BucketName String
    The S3 bucket name.
    s3KeyPrefix String
    The S3 bucket prefix. Results stored in the root if not configured.
    s3Region String

    The S3 bucket region.

    Targets specify what instance IDs or tags to apply the document to and has these keys:

    AssociationTarget, AssociationTargetArgs

    Key string
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    Values List<string>
    User-defined criteria that maps to Key. A list of instance IDs or tag values.
    Key string
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    Values []string
    User-defined criteria that maps to Key. A list of instance IDs or tag values.
    key String
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    values List<String>
    User-defined criteria that maps to Key. A list of instance IDs or tag values.
    key string
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    values string[]
    User-defined criteria that maps to Key. A list of instance IDs or tag values.
    key str
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    values Sequence[str]
    User-defined criteria that maps to Key. A list of instance IDs or tag values.
    key String
    Either InstanceIds or tag:Tag Name to specify an EC2 tag.
    values List<String>
    User-defined criteria that maps to Key. A list of instance IDs or tag values.

    Import

    Using pulumi import, import SSM associations using the association_id. For example:

    $ pulumi import aws:ssm/association:Association test-association 10abcdef-0abc-1234-5678-90abcdef123456
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi