跳转到主要内容

一种将EC2实例的标签传播到EBS卷,然后再传播到EBS快照的服务

项目描述

Join the chat at https://gitter.im/Answers4AWS/graffiti-monkey Build Status

涂鸦猴子在四处标记事物。通过查看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调用AWS API。您可以通过使用.boto文件、IAM角色或环境变量将您的AWS凭证传递给Boto。完整信息可以在以下找到

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 pip install PyYAML轻松设置。如果您不使用配置文件,则没有这种限制。

使用pip pip install PyYAML。如果您不使用配置文件,则没有这种限制。

Wiki

可以在以下位置找到: https://github.com/Answers4AWS/graffiti-monkey/wiki

源代码

Graffiti Monkey 的 Python 源代码可在 GitHub 上找到

https://github.com/Answers4AWS/graffiti-monkey

关于 Answers for AWS

此代码由 Peter Sankauskas 编写,他是 Answers for AWS 的创始人 - 一家专注于帮助企业在不采取困难方式的情况下学习如何使用 AWS 的公司。如果您需要 AWS 的帮助,请 联系我们

许可证

版权所有 2013 Answers for AWS LLC

根据 Apache 许可证 2.0 版(“许可证”);除非您遵守许可证规定,否则不得使用此文件。您可以在以下位置获得许可证副本:

https://apache.ac.cn/licenses/LICENSE-2.0 除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”基础分发,不提供任何形式(明示或暗示)的保证或条件。有关许可证的权限和限制的具体语言,请参阅许可证。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分布

graffiti_monkey-0.9.0.tar.gz (14.2 kB 查看哈希)

上传时间

由以下机构支持