将标记从ec2实例传播到ebs卷,然后再传播到ebs快照的服务。
graffiti_monke的Python项目详细描述
涂鸦猴子到处乱涂标签。通过查看标签ec2 实例有,它将这些标记复制到附加到它的ebs卷, 然后将这些标记复制到ebs快照。
用法
usage: graffiti-monkey [-h] [--region REGION] [--profile PROFILE] [--verbose] [--version] [--config CONFIG.YML] [--dryrun] Propagates tags from AWS EC2 instances to EBS volumes, and then to EBS snapshots. This makes it much easier to find things down the road. optional arguments: -h, --help show this help message and exit --region REGION the region to tag things in (default is current region of EC2 instance this is running on). E.g. us-east-1 --profile PROFILE the profile to use to connect to EC2 (default is 'default', see Boto docs for profile credential options) --verbose, -v enable verbose output (-vvv for more) --version display version number and exit --config CONFIG.YML read a yaml configuration file. specify tags to propagate without changing code. --dryrun dryrun only, display tagging actions but do not perform them --append append propagated tags to existing tags (up to a total of ten tags). When not set, graffiti-monkey will overwrite existing tags.
示例
假设您在US-EAST-1中有以下内容:
i-abcd1234 - Tags: - Name: "Instance 1" vol-bcde3456 - Attached to i-abcd1234 on /dev/sda1 snap-cdef4567 - Snapshot of vol-bcde3456
跑步时:
graffiti-monkey --region us-east-1
首先,涂鸦猴子将设置EBS音量标签
vol-bcde3456 - Tags: - Name: "Instance 1" - instance_id: i-abcd1234 - device: /dev/sda1
然后它将设置EBS快照上的标记
snap-cdef4567 - Tags: - Name: "Instance 1" - instance_id: i-abcd1234 - device: /dev/sda1
安装
您可以使用通常的pypi通道安装涂鸦猴子。示例:
sudo pip install graffiti_monkey
您可以在这里找到包的详细信息:https://pypi.python.org/pypi/graffiti_monkey
或者,如果您希望从源安装:
git clone git@github.com:Answers4AWS/graffiti-monkey.git cd graffiti-monkey python setup.py install
配置
此项目使用Boto来
调用awsapi。您可以使用
.boto
文件、IAM角色或环境变量。完整的信息可以是
在此处找到:
http://boto.readthedocs.org/en/latest/boto_config_tut.html
涂鸦猴子本身可以使用yaml文件进行配置
--- #region: us-west-1 _instance_tags_to_propagate: - 'Name' - 'Owner' _volume_tags_to_propagate: - 'Name' - 'instance_id' - 'device' - 'Owner'
_instance_tags_to_propagate
用于定义传播的标记
从实例到其卷。_volume_tags_to_propagate
定义标记
从卷传播到其快照的。
- 使用yaml配置文件时,需要使用pyyaml。这很容易设置 使用pip{
关于AWS的答案
这段代码是由Peter Sankauskas撰写的,他是Answers for AWS-一家专注于帮助企业的公司的创始人 学习如何使用aws,而不必费力。如果你在寻求帮助 有了aws,请contact us。
许可证
AWS LLC版权所有2013 answers
根据apache许可证2.0版(以下简称“许可证”)授权;您可以 除非符合许可证,否则不要使用此文件。你可以获得 在
http://www.apache.org/licenses/LICENSE-2.0除非适用的要求 法律或书面同意,根据许可证分发的软件是 按“原样”分配,无任何保证或条件 善意的,明示的或暗示的。具体见许可证 管理许可下的权限和限制的语言。