com.pulumi.aws.ssm.Association Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws Show documentation
Show all versions of aws Show documentation
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.aws.ssm;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.ssm.AssociationArgs;
import com.pulumi.aws.ssm.inputs.AssociationState;
import com.pulumi.aws.ssm.outputs.AssociationOutputLocation;
import com.pulumi.aws.ssm.outputs.AssociationTarget;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Associates an SSM Document to an instance or EC2 tag.
*
* ## Example Usage
*
* ### Create an association for a specific instance
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### 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`.
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### 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`.
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### Create an association with a specific schedule
*
* This example shows how to schedule an association in various ways.
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Using `pulumi import`, import SSM associations using the `association_id`. For example:
*
* ```sh
* $ pulumi import aws:ssm/association:Association test-association 10abcdef-0abc-1234-5678-90abcdef123456
* ```
*
*/
@ResourceType(type="aws:ssm/association:Association")
public class Association extends com.pulumi.resources.CustomResource {
/**
* 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`.
*
*/
@Export(name="applyOnlyAtCronInterval", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> applyOnlyAtCronInterval;
/**
* @return 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`.
*
*/
public Output> applyOnlyAtCronInterval() {
return Codegen.optional(this.applyOnlyAtCronInterval);
}
/**
* The ARN of the SSM association
*
*/
@Export(name="arn", refs={String.class}, tree="[0]")
private Output arn;
/**
* @return The ARN of the SSM association
*
*/
public Output arn() {
return this.arn;
}
/**
* The ID of the SSM association.
*
*/
@Export(name="associationId", refs={String.class}, tree="[0]")
private Output associationId;
/**
* @return The ID of the SSM association.
*
*/
public Output associationId() {
return this.associationId;
}
/**
* The descriptive name for the association.
*
*/
@Export(name="associationName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> associationName;
/**
* @return The descriptive name for the association.
*
*/
public Output> associationName() {
return Codegen.optional(this.associationName);
}
/**
* 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.
*
*/
@Export(name="automationTargetParameterName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> automationTargetParameterName;
/**
* @return 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.
*
*/
public Output> automationTargetParameterName() {
return Codegen.optional(this.automationTargetParameterName);
}
/**
* The compliance severity for the association. Can be one of the following: `UNSPECIFIED`, `LOW`, `MEDIUM`, `HIGH` or `CRITICAL`
*
*/
@Export(name="complianceSeverity", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> complianceSeverity;
/**
* @return The compliance severity for the association. Can be one of the following: `UNSPECIFIED`, `LOW`, `MEDIUM`, `HIGH` or `CRITICAL`
*
*/
public Output> complianceSeverity() {
return Codegen.optional(this.complianceSeverity);
}
/**
* The document version you want to associate with the target(s). Can be a specific version or the default version.
*
*/
@Export(name="documentVersion", refs={String.class}, tree="[0]")
private Output documentVersion;
/**
* @return The document version you want to associate with the target(s). Can be a specific version or the default version.
*
*/
public Output documentVersion() {
return this.documentVersion;
}
/**
* 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
* use 'targets' argument instead. https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateAssociation.html#systemsmanager-CreateAssociation-request-InstanceId
*
*/
@Deprecated /* use 'targets' argument instead. https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateAssociation.html#systemsmanager-CreateAssociation-request-InstanceId */
@Export(name="instanceId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> instanceId;
/**
* @return 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.
*
*/
public Output> instanceId() {
return Codegen.optional(this.instanceId);
}
/**
* 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%.
*
*/
@Export(name="maxConcurrency", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> maxConcurrency;
/**
* @return 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%.
*
*/
public Output> maxConcurrency() {
return Codegen.optional(this.maxConcurrency);
}
/**
* 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.
*
*/
@Export(name="maxErrors", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> maxErrors;
/**
* @return 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.
*
*/
public Output> maxErrors() {
return Codegen.optional(this.maxErrors);
}
/**
* The name of the SSM document to apply.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the SSM document to apply.
*
*/
public Output name() {
return this.name;
}
/**
* An output location block. Output Location is documented below.
*
*/
@Export(name="outputLocation", refs={AssociationOutputLocation.class}, tree="[0]")
private Output* @Nullable */ AssociationOutputLocation> outputLocation;
/**
* @return An output location block. Output Location is documented below.
*
*/
public Output> outputLocation() {
return Codegen.optional(this.outputLocation);
}
/**
* A block of arbitrary string parameters to pass to the SSM document.
*
*/
@Export(name="parameters", refs={Map.class,String.class}, tree="[0,1,1]")
private Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy