Creates a new tag-sync task to onboard and sync resources tagged with a specific tag key-value pair to an application¶
Description¶
Creates a new tag-sync task to onboard and sync resources tagged with a specific tag key-value pair to an application. To start a tag-sync task, you need a resource tagging role. The resource tagging role grants permissions to tag and untag applications resources and must include a trust policy that allows Resource Groups to assume the role and perform resource tagging tasks on your behalf.
For instructions on creating a tag-sync task, see Create a tag-sync using the Resource Groups API in the Amazon Web Services Service Catalog AppRegistry Administrator Guide.
Minimum permissions
To run this command, you must have the following permissions:
resource-groups:StartTagSyncTaskon the application groupresource-groups:CreateGroupiam:PassRoleon the role provided in the request
Usage¶
Arguments¶
-
Group[required] The Amazon resource name (ARN) or name of the application group for which you want to create a tag-sync task.
-
TagKeyThe tag key. Resources tagged with this tag key-value pair will be added to the application. If a resource with this tag is later untagged, the tag-sync task removes the resource from the application.
When using the
TagKeyparameter, you must also specify theTagValueparameter. If you specify a tag key-value pair, you can't use theResourceQueryparameter. -
TagValueThe tag value. Resources tagged with this tag key-value pair will be added to the application. If a resource with this tag is later untagged, the tag-sync task removes the resource from the application.
When using the
TagValueparameter, you must also specify theTagKeyparameter. If you specify a tag key-value pair, you can't use theResourceQueryparameter. -
ResourceQueryThe query you can use to create the tag-sync task. With this method, all resources matching the query are added to the specified application group. A
ResourceQueryspecifies both a queryTypeand aQuerystring as JSON string objects. For more information on defining a resource query for a tag-sync task, see the tag-based query type in Types of resource group queries in Resource Groups User Guide.When using the
ResourceQueryparameter, you cannot use theTagKeyandTagValueparameters.When you combine all of the elements together into a single string, any double quotes that are embedded inside another double quote pair must be escaped by preceding the embedded double quote with a backslash character (). For example, a complete
ResourceQueryparameter must be formatted like the following CLI parameter example:--resource-query '{"Type":"TAG_FILTERS_1_0","Query":"{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[{\"Key\":\"Stage\",\"Values\":[\"Test\"]}]}"}'In the preceding example, all of the double quote characters in the value part of the
Queryelement must be escaped because the value itself is surrounded by double quotes. For more information, see Quoting strings in the Command Line Interface User Guide.For the complete list of resource types that you can use in the array value for
ResourceTypeFilters, see Resources you can use with Resource Groups and Tag Editor in the Resource Groups User Guide. For example:"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"] -
RoleArn[required] The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.
Value¶
A list with the following syntax:
list(
GroupArn = "string",
GroupName = "string",
TaskArn = "string",
TagKey = "string",
TagValue = "string",
ResourceQuery = list(
Type = "TAG_FILTERS_1_0"|"CLOUDFORMATION_STACK_1_0",
Query = "string"
),
RoleArn = "string"
)