将标记从ec2实例传播到ebs卷,然后再传播到ebs快照的服务。

graffiti_monke的Python项目详细描述


Join the chat at https://gitter.im/Answers4AWS/graffiti-monkeyBuild 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来 调用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{}。如果不使用配置文件 此限制。

源代码

github上提供了graffiti monkey的python源代码:

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

关于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除非适用的要求 法律或书面同意,根据许可证分发的软件是 按“原样”分配,无任何保证或条件 善意的,明示的或暗示的。具体见许可证 管理许可下的权限和限制的语言。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android Action_Edit Intent无法像以前一样调用App Gallery来编辑图片   确保JRE兼容性的java适当程序(32或64位)   java JSONArray。for循环中的add(JSONObject)正在替换for循环中的旧值,数组由循环中的最后一个值组成   java需要帮助创建一个返回数组的方法,该数组的元素是另一个数组的平方   使用SmbFile w/groovy XmlSluper()创建xml。解析()Java   检查大小后的java ArrayIndexOutOfBoundsException   乘法表中的第k个最小元素   java 401 on请求,其中指定了'permitAll()'   java如何附加ORC文件   java hibernate类模型   java IDEA没有看到由自定义注释处理器生成的方法   Servlet中未声明java SerialVersionId   java linkedlist到达列表末尾时   java如何正确对齐EditText光标?   java 6编译器1.6上的eclipse重写方法错误   java如何在基于Jersey的RESTful Web服务中读取post数据   java如何在活动中正确使用接口?   Java的JIT编译器的工作速度有多快?