...
You need to specify an appropriate tag based resource filter in JSON format (insert fragments from the inline Examples dialog to get started):
Add an Amazon EC2 Instance task and select the Stop Instance(s) action.
Select the desired AWS region and AWS security credentials as usual.
Click on the Examples button and select the Tag (key only) example filter declaration.
Replace the "Environment" sample filter value for the filter "tag-key" with "Name" so that the resulting filter declaration looks as follows:
Code Block language js [ { "Name": "tag-key", "Values": ["Name"] } ]
Alternatively, you can select the Tag (key and value) example filter declaration with a filter "tag:Name" and a wildcard value "*" as follows:
Code Block language js [ { "Name": "tag:Name", "Values": ["*"] } ]
Save the task.
Due to "Name" being a default tag available for every resource, when you run the task, it will target all EC2 instances in this region, no matter what their actual name is.
Tip | |
---|---|
title | Prevent failing builds in regions without resourcesYou can also check Don't fail for empty filter result to prevent the task failing if no matching resources are found. |
Related articles
Filter by label (Content by label) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...
|
Page Properties | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
server | JIRA (
Jira Legacy | columns | key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution | serverId | fac61c2e-db0a-39da-bb3c-e0dc0ef556f0 | key | |
[ { "Name": "tag:Name", "Values": ["*"] }]