Class: AWSCDK::SSM::CfnAssociationProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ssm/cfn_association_props.rb

Overview

Properties for defining a CfnAssociation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, apply_only_at_cron_interval: nil, association_dispatch_assume_role: nil, association_name: nil, automation_target_parameter_name: nil, calendar_names: nil, compliance_severity: nil, document_version: nil, instance_id: nil, max_concurrency: nil, max_errors: nil, output_location: nil, parameters: nil, schedule_expression: nil, schedule_offset: nil, sync_compliance: nil, tags: nil, targets: nil, wait_for_success_timeout_seconds: nil) ⇒ CfnAssociationProps

Returns a new instance of CfnAssociationProps.

Parameters:

  • name (String, AWSCDK::Interfaces::AWSSSM::IDocumentRef)

    The name of the SSM document that contains the configuration information for the instance.

  • apply_only_at_cron_interval (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    By default, when you create a new association, the system runs it immediately after it is created and then according to the schedule you specified.

  • association_dispatch_assume_role (String, nil) (defaults to: nil)

    A role used by association to take actions on your behalf.

  • association_name (String, nil) (defaults to: nil)

    Specify a descriptive name for the association.

  • automation_target_parameter_name (String, nil) (defaults to: nil)

    Choose the parameter that will define how your automation will branch out.

  • calendar_names (Array<String>, nil) (defaults to: nil)

    The names or Amazon Resource Names (ARNs) of the Change Calendar type documents your associations are gated under.

  • compliance_severity (String, nil) (defaults to: nil)

    The severity level that is assigned to the association.

  • document_version (String, nil) (defaults to: nil)

    The version of the SSM document to associate with the target.

  • instance_id (String, nil) (defaults to: nil)

    InstanceId has been deprecated.

  • max_concurrency (String, nil) (defaults to: nil)

    The maximum number of targets allowed to run the association at the same time.

  • max_errors (String, nil) (defaults to: nil)

    The number of errors that are allowed before the system stops sending requests to run the association on additional targets.

  • output_location (AWSCDK::IResolvable, AWSCDK::SSM::CfnAssociation::InstanceAssociationOutputLocationProperty, nil) (defaults to: nil)

    An Amazon Simple Storage Service (Amazon S3) bucket where you want to store the output details of the request.

  • parameters (Object, nil) (defaults to: nil)

    The parameters for the runtime configuration of the document.

  • schedule_expression (String, nil) (defaults to: nil)

    A cron expression that specifies a schedule when the association runs.

  • schedule_offset (Numeric, nil) (defaults to: nil)

    Number of days to wait after the scheduled day to run an association.

  • sync_compliance (String, nil) (defaults to: nil)

    The mode for generating association compliance.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    A key-value pair to associate with a resource.

  • targets (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::SSM::CfnAssociation::TargetProperty>, nil) (defaults to: nil)

    The targets for the association.

  • wait_for_success_timeout_seconds (Numeric, nil) (defaults to: nil)

    The number of seconds the service should wait for the association status to show "Success" before proceeding with the stack execution.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'ssm/cfn_association_props.rb', line 28

def initialize(name:, apply_only_at_cron_interval: nil, association_dispatch_assume_role: nil, association_name: nil, automation_target_parameter_name: nil, calendar_names: nil, compliance_severity: nil, document_version: nil, instance_id: nil, max_concurrency: nil, max_errors: nil, output_location: nil, parameters: nil, schedule_expression: nil, schedule_offset: nil, sync_compliance: nil, tags: nil, targets: nil, wait_for_success_timeout_seconds: nil)
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19zc20uSURvY3VtZW50UmVmIn1dfX0=")), "name")
  @apply_only_at_cron_interval = apply_only_at_cron_interval
  Jsii::Type.check_type(@apply_only_at_cron_interval, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "applyOnlyAtCronInterval") unless @apply_only_at_cron_interval.nil?
  @association_dispatch_assume_role = association_dispatch_assume_role
  Jsii::Type.check_type(@association_dispatch_assume_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "associationDispatchAssumeRole") unless @association_dispatch_assume_role.nil?
  @association_name = association_name
  Jsii::Type.check_type(@association_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "associationName") unless @association_name.nil?
  @automation_target_parameter_name = automation_target_parameter_name
  Jsii::Type.check_type(@automation_target_parameter_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "automationTargetParameterName") unless @automation_target_parameter_name.nil?
  @calendar_names = calendar_names
  Jsii::Type.check_type(@calendar_names, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "calendarNames") unless @calendar_names.nil?
  @compliance_severity = compliance_severity
  Jsii::Type.check_type(@compliance_severity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "complianceSeverity") unless @compliance_severity.nil?
  @document_version = document_version
  Jsii::Type.check_type(@document_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "documentVersion") unless @document_version.nil?
  @instance_id = instance_id
  Jsii::Type.check_type(@instance_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceId") unless @instance_id.nil?
  @max_concurrency = max_concurrency
  Jsii::Type.check_type(@max_concurrency, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxConcurrency") unless @max_concurrency.nil?
  @max_errors = max_errors
  Jsii::Type.check_type(@max_errors, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxErrors") unless @max_errors.nil?
  @output_location = output_location.is_a?(Hash) ? ::AWSCDK::SSM::CfnAssociation::InstanceAssociationOutputLocationProperty.new(**output_location.transform_keys(&:to_sym)) : output_location
  Jsii::Type.check_type(@output_location, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zc20uQ2ZuQXNzb2NpYXRpb24uSW5zdGFuY2VBc3NvY2lhdGlvbk91dHB1dExvY2F0aW9uUHJvcGVydHkifV19fQ==")), "outputLocation") unless @output_location.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "parameters") unless @parameters.nil?
  @schedule_expression = schedule_expression
  Jsii::Type.check_type(@schedule_expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "scheduleExpression") unless @schedule_expression.nil?
  @schedule_offset = schedule_offset
  Jsii::Type.check_type(@schedule_offset, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "scheduleOffset") unless @schedule_offset.nil?
  @sync_compliance = sync_compliance
  Jsii::Type.check_type(@sync_compliance, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "syncCompliance") unless @sync_compliance.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @targets = targets
  Jsii::Type.check_type(@targets, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3NtLkNmbkFzc29jaWF0aW9uLlRhcmdldFByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "targets") unless @targets.nil?
  @wait_for_success_timeout_seconds = wait_for_success_timeout_seconds
  Jsii::Type.check_type(@wait_for_success_timeout_seconds, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "waitForSuccessTimeoutSeconds") unless @wait_for_success_timeout_seconds.nil?
end

Instance Attribute Details

#apply_only_at_cron_intervalBoolean, ... (readonly)

By default, when you create a new association, the system runs it immediately after it is created and then according to the schedule you specified.

Specify this option if you don't want an association to run immediately after you create it. This parameter is not supported for rate expressions.



88
89
90
# File 'ssm/cfn_association_props.rb', line 88

def apply_only_at_cron_interval
  @apply_only_at_cron_interval
end

#association_dispatch_assume_roleString? (readonly)

A role used by association to take actions on your behalf.



93
94
95
# File 'ssm/cfn_association_props.rb', line 93

def association_dispatch_assume_role
  @association_dispatch_assume_role
end

#association_nameString? (readonly)

Specify a descriptive name for the association.



98
99
100
# File 'ssm/cfn_association_props.rb', line 98

def association_name
  @association_name
end

#automation_target_parameter_nameString? (readonly)

Choose the parameter that will define how your automation will branch out.

This target is required for associations that use an Automation runbook and target resources by using rate controls. Automation is a tool in AWS Systems Manager .



105
106
107
# File 'ssm/cfn_association_props.rb', line 105

def automation_target_parameter_name
  @automation_target_parameter_name
end

#calendar_namesArray<String>? (readonly)

The names or Amazon Resource Names (ARNs) of the Change Calendar type documents your associations are gated under.

The associations only run when that Change Calendar is open. For more information, see AWS Systems Manager Change Calendar in the AWS Systems Manager User Guide .



112
113
114
# File 'ssm/cfn_association_props.rb', line 112

def calendar_names
  @calendar_names
end

#compliance_severityString? (readonly)

The severity level that is assigned to the association.



117
118
119
# File 'ssm/cfn_association_props.rb', line 117

def compliance_severity
  @compliance_severity
end

#document_versionString? (readonly)

The version of the SSM document to associate with the target.

Note the following important information.

  • State Manager doesn't support running associations that use a new version of a document if that document is shared from another account. State Manager always runs the default version of a document if shared from another account, even though the Systems Manager console shows that a new version was processed. If you want to run an association using a new version of a document shared form another account, you must set the document version to default .
  • DocumentVersion is not valid for documents owned by AWS , such as AWS-RunPatchBaseline or AWS-UpdateSSMAgent . If you specify DocumentVersion for an AWS document, the system returns the following error: "Error occurred during operation 'CreateAssociation'." (RequestToken: , HandlerErrorCode: GeneralServiceException).


127
128
129
# File 'ssm/cfn_association_props.rb', line 127

def document_version
  @document_version
end

#instance_idString? (readonly)

InstanceId has been deprecated.

To specify an instance ID for an association, use the Targets parameter. If you use the parameter InstanceId , you cannot use the parameters AssociationName , DocumentVersion , MaxErrors , MaxConcurrency , OutputLocation , or ScheduleExpression . To use these parameters, you must use the Targets parameter.

Note that in some examples later in this page, InstanceIds is used as the tag-key name in a Targets filter. InstanceId is not used as a parameter.

The ID of the instance that the SSM document is associated with. You must specify the InstanceId or Targets property.



138
139
140
# File 'ssm/cfn_association_props.rb', line 138

def instance_id
  @instance_id
end

#max_concurrencyString? (readonly)

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%. The default value is 100%, which means all targets run the association at the same time.

If a new managed node starts and attempts to run an association while Systems Manager is running MaxConcurrency associations, the association is allowed to run. During the next association interval, the new managed node will process its association within the limit specified for MaxConcurrency .



147
148
149
# File 'ssm/cfn_association_props.rb', line 147

def max_concurrency
  @max_concurrency
end

#max_errorsString? (readonly)

The number of errors that are allowed before the system stops sending requests to run the association on additional targets.

You can specify either an absolute number of errors, for example 10, or a percentage of the target set, for example 10%. If you specify 3, for example, the system stops sending requests when the fourth error is received. If you specify 0, then the system stops sending requests after the first error is returned. If you run an association on 50 managed nodes and set MaxError to 10%, then the system stops sending the request when the sixth error is received.

Executions that are already running an association when MaxErrors is reached are allowed to complete, but some of these executions may fail as well. If you need to ensure that there won't be more than max-errors failed executions, set MaxConcurrency to 1 so that executions proceed one at a time.



156
157
158
# File 'ssm/cfn_association_props.rb', line 156

def max_errors
  @max_errors
end

#nameString, AWSCDK::Interfaces::AWSSSM::IDocumentRef (readonly)

The name of the SSM document that contains the configuration information for the instance.

You can specify Command or Automation documents. The documents can be AWS -predefined documents, documents you created, or a document that is shared with you from another account. For SSM documents that are shared with you from other AWS accounts , you must specify the complete SSM document ARN, in the following format:

arn:partition:ssm:region:account-id:document/document-name

For example: arn:aws:ssm:us-east-2:12345678912:document/My-Shared-Document

For AWS -predefined documents and SSM documents you created in your account, you only need to specify the document name. For example, AWS -ApplyPatchBaseline or My-Document .



81
82
83
# File 'ssm/cfn_association_props.rb', line 81

def name
  @name
end

#output_locationAWSCDK::IResolvable, ... (readonly)

An Amazon Simple Storage Service (Amazon S3) bucket where you want to store the output details of the request.



161
162
163
# File 'ssm/cfn_association_props.rb', line 161

def output_location
  @output_location
end

#parametersObject? (readonly)

The parameters for the runtime configuration of the document.



166
167
168
# File 'ssm/cfn_association_props.rb', line 166

def parameters
  @parameters
end

#schedule_expressionString? (readonly)

A cron expression that specifies a schedule when the association runs.

The schedule runs in Coordinated Universal Time (UTC).



173
174
175
# File 'ssm/cfn_association_props.rb', line 173

def schedule_expression
  @schedule_expression
end

#schedule_offsetNumeric? (readonly)

Number of days to wait after the scheduled day to run an association.



178
179
180
# File 'ssm/cfn_association_props.rb', line 178

def schedule_offset
  @schedule_offset
end

#sync_complianceString? (readonly)

The mode for generating association compliance.

You can specify AUTO or MANUAL . In AUTO mode, the system uses the status of the association execution to determine the compliance status. If the association execution runs successfully, then the association is COMPLIANT . If the association execution doesn't run successfully, the association is NON-COMPLIANT .

In MANUAL mode, you must specify the AssociationId as a parameter for the PutComplianceItems API action. In this case, compliance data is not managed by State Manager. It is managed by your direct call to the PutComplianceItems API action.

By default, all associations use AUTO mode.



189
190
191
# File 'ssm/cfn_association_props.rb', line 189

def sync_compliance
  @sync_compliance
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

A key-value pair to associate with a resource.



194
195
196
# File 'ssm/cfn_association_props.rb', line 194

def tags
  @tags
end

#targetsAWSCDK::IResolvable, ... (readonly)

The targets for the association.

You must specify the InstanceId or Targets property. You can target all instances in an AWS account by specifying t he InstanceIds key with a value of * .

Supported formats include the following.

  • Key=InstanceIds,Values=<instance-id-1>,<instance-id-2>,<instance-id-3>
  • Key=tag-key,Values=<my-tag-key-1>,<my-tag-key-2>

To view a JSON and a YAML example that targets all instances, see "Create an association for all managed instances in an AWS account " on the Examples page.



208
209
210
# File 'ssm/cfn_association_props.rb', line 208

def targets
  @targets
end

#wait_for_success_timeout_secondsNumeric? (readonly)

The number of seconds the service should wait for the association status to show "Success" before proceeding with the stack execution.

If the association status doesn't show "Success" after the specified number of seconds, then stack creation fails.

When you specify a value for the WaitForSuccessTimeoutSeconds , drift detection for your CloudFormation stack’s configuration might yield inaccurate results. If drift detection is important in your scenario, we recommend that you don’t include WaitForSuccessTimeoutSeconds in your template.



217
218
219
# File 'ssm/cfn_association_props.rb', line 217

def wait_for_success_timeout_seconds
  @wait_for_success_timeout_seconds
end

Class Method Details

.jsii_propertiesObject



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'ssm/cfn_association_props.rb', line 219

def self.jsii_properties
  {
    :name => "name",
    :apply_only_at_cron_interval => "applyOnlyAtCronInterval",
    :association_dispatch_assume_role => "associationDispatchAssumeRole",
    :association_name => "associationName",
    :automation_target_parameter_name => "automationTargetParameterName",
    :calendar_names => "calendarNames",
    :compliance_severity => "complianceSeverity",
    :document_version => "documentVersion",
    :instance_id => "instanceId",
    :max_concurrency => "maxConcurrency",
    :max_errors => "maxErrors",
    :output_location => "outputLocation",
    :parameters => "parameters",
    :schedule_expression => "scheduleExpression",
    :schedule_offset => "scheduleOffset",
    :sync_compliance => "syncCompliance",
    :tags => "tags",
    :targets => "targets",
    :wait_for_success_timeout_seconds => "waitForSuccessTimeoutSeconds",
  }
end

Instance Method Details

#to_jsiiObject



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'ssm/cfn_association_props.rb', line 243

def to_jsii
  result = {}
  result.merge!({
    "name" => @name,
    "applyOnlyAtCronInterval" => @apply_only_at_cron_interval,
    "associationDispatchAssumeRole" => @association_dispatch_assume_role,
    "associationName" => @association_name,
    "automationTargetParameterName" => @automation_target_parameter_name,
    "calendarNames" => @calendar_names,
    "complianceSeverity" => @compliance_severity,
    "documentVersion" => @document_version,
    "instanceId" => @instance_id,
    "maxConcurrency" => @max_concurrency,
    "maxErrors" => @max_errors,
    "outputLocation" => @output_location,
    "parameters" => @parameters,
    "scheduleExpression" => @schedule_expression,
    "scheduleOffset" => @schedule_offset,
    "syncCompliance" => @sync_compliance,
    "tags" => @tags,
    "targets" => @targets,
    "waitForSuccessTimeoutSeconds" => @wait_for_success_timeout_seconds,
  })
  result.compact
end