AWS::SSM::Association
The AWS::SSM::Association resource associates an SSM document in AWS Systems Manager with
EC2 instances that contain a configuration agent to process the document.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::SSM::Association", "Properties" : { "AssociationName" :String, "DocumentVersion" :String, "InstanceId" :String, "Name" :String, "OutputLocation" : InstanceAssociationOutputLocation , "Parameters" : {String: [String, ...] }, "ScheduleExpression" :String, "Targets" : [ Targets ] } }
YAML
Type: "AWS::SSM::Association" Properties: AssociationName:StringDocumentVersion:StringInstanceId:StringName:StringOutputLocation: InstanceAssociationOutputLocation Parameters:String: - StringScheduleExpression:StringTargets: -Targets
Properties
AssociationName-
The name of the association.
Required: No
Type: String
Update requires: No interruption
DocumentVersion-
The version of the SSM document to associate with the target.
Required: No
Type: String
Update requires: No interruption
InstanceId-
The ID of the instance that the SSM document is associated with.
Required: Conditional. You must specify the
InstanceIdorTargetsproperty.Type: String
Update requires: Replacement
Name-
The name of the SSM document.
Required: Yes
Type: String
Update requires: Replacement
OutputLocation-
An Amazon S3 bucket where you want to store the results of this request.
Required: No
Type: InstanceAssociationOutputLocation
Update requires: No interruption
Parameters-
Parameter values that the SSM document uses at runtime.
Required: No
Type: String to list-of-strings map
Update requires: No interruption
ScheduleExpression-
A Cron expression that specifies when the association is applied to the target. For more on working with Cron expressions, see Working with Cron and Rate Expressions for Systems Manager.
Required: No
Type: String
Update requires: No interruption
Targets-
The targets that the SSM document sends commands to.
Required: Conditional. You must specify the
InstanceIdorTargetsproperty.Type: List of AWS Systems Manager Association Targets
Update requires: Replacement
Example
The following example associates an SSM document with a specific instance. The ID
of the
instance is specified by the myInstanceId parameter.
JSON
"association": { "Type": "AWS::SSM::Association", "Properties": { "Name": { "Ref": "document" }, "Parameters": { "Directory": ["myWorkSpace"] }, "Targets": [{ "Key": "InstanceIds", "Values": [{ "Ref": "myInstanceId" }] }] } }
YAML
association: Type: AWS::SSM::Association Properties: Name: !Ref 'document' Parameters: Directory: [FakeDirectory] Targets: - Key: InstanceIds Values: [!Ref 'myInstanceId']
