Python CLI for tagging AWS resources based on a YAML configuration
Project description
Awstaga
Awstaga is a Python CLI for tagging AWS resources based on a YAML configuration.
Installation
pip3 install awstaga
Usage
Create a configuration file, e.g. awstaga.yaml
:
---
tagsets:
- name: common
tags:
- key: CostCentre
value: FIN-123
- key: Organisation
value: World Enterprise
- key: Description
value: AWS Resource
- name: prod
tags:
- key: EnvType
value: prod
- key: Availability
value: 24x7
- name: nonprod
tags:
- key: EnvType
value: non-prod
- key: Availability
value: on-demand
resources:
- arn: 'arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail'
tags:
- key: Description
value: High availability SSM document
tagsetnames:
- common
- prod
- arn: 'arn:aws:s3:::world-enterprise/development/logo.jpg'
tags:
- key: Description
value: World Enterprise logo
tagsetnames:
- common
- nonprod
And then run awstaga
CLI and pass the configuration file path:
awstaga --conf-file awstaga.yaml
It will write the log messages to stdout:
[awstaga] INFO Loading configuration file awstaga.yaml
[awstaga] INFO Loading 3 tagset(s)...
[awstaga] INFO Loading 2 resource(s)...
[awstaga] INFO Updating resource arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail with tags {'CostCentre': 'FIN-123', 'Organisation': 'World Enterprise', 'Description': 'AWS Resource', 'EnvType': 'prod', 'Availability': '24x7', 'Description': 'High availability SSM document'}
[awstaga] INFO Updating resource arn:aws:s3:::world-enterprise/development/logo.jpg with tags {'CostCentre': 'FIN-123', 'Organisation': 'World Enterprise', 'Description': 'AWS Resource', 'EnvType': 'prod', 'Availability': '24x7', 'Description': 'World Enterprise logo'}
Configuration
Configuration properties:
Property | Type | Description | Example |
---|---|---|---|
tagsets[] |
Array | A list of one or more tagsets. Any tagset can be associated with any resource, and the resource will include the tags specified in the tagset. | |
tagsets[].name |
String | The name of the tagset. | common |
tagsets[].tags[] |
Array | A list of one or more key-value pair tags within the tagset. | |
tagsets[].tags[].key |
String | The tag key. | CostCentre |
tagsets[].tags[].value |
String | The tag value. | FIN-123 |
resources[] |
Array | A list of one or more AWS resources. Each of the resource has a corresponding list of tags, along with the tags from tagsets. | |
resources[].arn |
String | AWS resource ARN. | arn:aws:s3:::world-enterprise/development/logo.jpg |
resources[].tags[] |
Array | A list of one or more key-value pair tags of the resource. | |
resources[].tags[].key |
String | The tag key. | Description |
resources[].tags[].value |
String | The tag value. | Some description |
resources[].tagsetnames[] |
Array | A list of one or more tagset names. All tags within the tagsets specified are included in the resource. |
Colophon
Build reports:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
awstaga-0.10.1.tar.gz
(11.0 kB
view details)
Built Distribution
awstaga-0.10.1-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file awstaga-0.10.1.tar.gz
.
File metadata
- Download URL: awstaga-0.10.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23f177067e6334f118aa17ccca80573022f8e6e349f075a6e686288b53a0a174 |
|
MD5 | 320f9cd12ae861f130a44b3aaa864b20 |
|
BLAKE2b-256 | 7417e124285f9510e6ddda6b5d10fc7bf729f10419ba8ffad1fb8beccfe2532a |
File details
Details for the file awstaga-0.10.1-py3-none-any.whl
.
File metadata
- Download URL: awstaga-0.10.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d2069314d6b1ee752b8f9c23b9f35eab39cead67ba52787997235e3b5801f55 |
|
MD5 | 54a344034665a4c7678a7bba71ded6da |
|
BLAKE2b-256 | 39305a43a0e79b0de4c108ec4e8e6db672bb02246faf1ee4b5a5b233eafdc4b9 |