Skip to content

create_tags

Operation

create_tags

create_tags(request: CreateTagsInput | CreateTagsInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateTagsInputDict]) -> CreateTagsOutput

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources. When you specify an existing tag key, the value is overwritten with the new value. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.

For more information about tags, see Tag your Amazon EC2 resources in the Amazon Elastic Compute Cloud User Guide. For more information about creating IAM policies that control users' access to resources based on tags, see Supported resource-level permissions for Amazon EC2 API actions in the Amazon Elastic Compute Cloud User Guide.

Parameters:

Name Type Description Default
request CreateTagsInput | CreateTagsInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreateTagsInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateTagsOutput

An instance of CreateTagsOutput.

create_tags async

create_tags(request: CreateTagsInput | CreateTagsInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateTagsInputDict]) -> CreateTagsOutput

Adds or overwrites only the specified tags for the specified Amazon EC2 resource or resources. When you specify an existing tag key, the value is overwritten with the new value. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.

For more information about tags, see Tag your Amazon EC2 resources in the Amazon Elastic Compute Cloud User Guide. For more information about creating IAM policies that control users' access to resources based on tags, see Supported resource-level permissions for Amazon EC2 API actions in the Amazon Elastic Compute Cloud User Guide.

Parameters:

Name Type Description Default
request CreateTagsInput | CreateTagsInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreateTagsInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateTagsOutput

An instance of CreateTagsOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreateTagsInputDict

Bases: TypedDict

Dictionary form of CreateTagsInput.

Attributes

dry_run instance-attribute
dry_run: bool | None

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

resources instance-attribute
resources: Required[Sequence[str]]

The IDs of the resources, separated by spaces.

Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.

tags instance-attribute

The tags. The value parameter is required, but if you don't want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.

CreateTagsInput dataclass

Bases: _SerdeShape

Dataclass for CreateTagsInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

resources class-attribute instance-attribute
resources: list[str] | None = ...

The IDs of the resources, separated by spaces.

Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.

tags class-attribute instance-attribute
tags: list[Tag] | None = ...

The tags. The value parameter is required, but if you don't want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.

Output

CreateTagsOutput dataclass

Bases: _SerdeShape

Dataclass for CreateTagsOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.