Skip to content

Instantly share code, notes, and snippets.

@yuklia
Last active July 21, 2020 07:18
Show Gist options
  • Save yuklia/0729cfcaa7eb21d663b1c3663a2c597f to your computer and use it in GitHub Desktop.
Save yuklia/0729cfcaa7eb21d663b1c3663a2c597f to your computer and use it in GitHub Desktop.
# 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
from datetime import datetime
client = boto3.client('ec2')
timestamp = datetime.timestamp(datetime.now())
response = client.create_tags(
Resources=[
'vol-01e66940668c0bda8',
],
Tags=[
{
'Key': 'Name',
'Value': 'Вредефорт_{0}'.format(timestamp),
},
],
)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment