Im trying to use the azure pipelines task SystemsManagerRunCommand@1 to run some ssm docs commands to install and update cloud watch agents on target machines.
However im having issues trying to identify the target machines via the tags used. Hoping someone could help out here.
Heres the current config:
- task: SystemsManagerRunCommand@1
displayName: "Install latest CwAgent"
inputs:
regionName: 'eu-central-1'
awsCredentials: my credentials
documentName: 'AWS-ConfigureAWSPackage'
documentParameters: >
{
"action": ["Install"],
"name": ["AmazonCloudWatchAgent"],
"version": ["latest"]
}
comment: 'Install latest version of cloud watch agent on target machines'
instanceSelector: 'fromTags'
instanceTags: not sure what to put here....
- task: SystemsManagerRunCommand@1
displayName: "Update agent with latest config"
inputs:
regionName: 'eu-central-1'
awsCredentials: my credentials
documentName: 'AmazonCloudWatch-ManageAgent'
documentParameters: >
{
"action": ["configure"],
"mode": ["ec2"],
"optionalConfigurationSource": ["ssm"],
"optionalConfigurationLocation": ["/CWAgent/CustomConfiguration.json"],
"optionalRestart": ["yes"]
}
comment: 'manage agent to use our custom config'
instanceSelector: 'fromTags'
instanceTags: not sure what to put here....
Im looking to implement something like this tag:example values=["value1", "value2"]. the only documentation i have been able to find is: https://docs.aws.amazon.com/vsts/latest/userguide/systemsmanager-runcommand.html
if some is able to help out and provide the expected format that would be amazing :)
If your pipeline was using the task SystemsManagerRunCommand@1
from the 3rd-party extension AWS Cloud VM Management, based on the description for the Tags
task property, we can target instances using Key=Value
and in my test below, my pipelines uses <tagName>=<tagValue>
like env=test
. The command sent to AWS SSM succeeded to pick up the instance without saying No Instances In Tag
.