volume_size = 0 client = boto3.client('ec2') response = client.describe_volumes()['Volumes'] for volume_info in response: volume_size += volume_info['Size'] return volume_size volume_size = get_volume_size() print(volume_size) 随着服务器的增多, EBS 使用 量也在逐渐增长。 如何快速 获取 EBS 的用量,可以 使用 如下脚本 aws ec2 describe-volumes --query 'Volumes[].[VolumeType,Size]' --output table | grep "\d" | awk '{total[$2]+=$4} END{for( i in total) print i,total[i]}' aws python 库The very first idea of creating my own app and deploying it on the cloud so that everyone could use it is super exciting to me, and this is what inspired me to write this post. If this idea... 本文转载自 https://gist.github.com/niranjv/f80fc1f488afc49845e2ff3d5df7f83b 由于Amazon Linux中预装的 Python 版本为2.7,该脚本教程很好地解决了在Amazon Linux中安装 Python 3.6的需求,遂转发记录至此。 # install pre-requisites sudo yum -y grou... ec2 = boto3.client(‘ec2’, region_name=’ap-southeast-1’) instances = ec2.describe_instances() for instance in instances: print(instance[‘InstanceId’])... 上一节我们提到了如何连接EC2,也就是boto.ec2.connect_to_region()方法。在连接到EC2后,我们可以 获取 当前所在区域的instance信息,下面我们来看几种常用的方法。首先还是先连接到EC2: import boto conn = boto.ec2.connect_to_region('ap-northeast-1') reservations = conn.get_ AWS 系列之三 使用 EBS Amazon Elastic Block Store( EBS )可作为EC2实例的持久性数据块级存储。其具有高可用性和持久性的特点,可用性高达99.999%。给现有的EC2实例扩展新的存储块只需要几分钟的时间,省时省力。每个 EBS 块都被放置在一个特定的可用区内,并且会自动维护一个副本,随时保护数据安全。 Amazon EBS 共提供三种硬盘类型,SSD(固态硬盘), Provisioned IOPS SSD(特供IOPS固态硬盘)和Magnetic(普通硬盘)。SSD是默认的EC实例 本文手把手,教你 使用 python 进行 AWS 的CloudTrail配置,进行日志抓取。进行数据分析,发现数据价值! 如今是云的时代,许多公司都把自己的IT架构部署在基础架构云(IaaS)上。著名的IaaS提供商有亚马逊,微软(Azure),IBM等,国内也有诸如阿里云等。其中,亚马逊毫无疑问是该市场的领军者。 AWS 提供了非常... 自己原来用itchat这个库弄了个消息转发器,这个库是基于网页版的微信的,其实就是收集关键字,然后有准对性的把这些记录转发到自己的内部群。 原先我把程序放在了谷歌云上,但是谷歌云一个是老是会莫名的断,能ping通但是ssh连不上,经常莫名会断,自己也没有深入去研究为什么,加上这两天谷歌云的console奇慢无比,再加上网页版的微信呢现在凌晨必断每天都要启动一次。 之程序挂了现在根本无法重启服务器,...