Advertisement
Guest User

Boto3 help

a guest
Jun 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. from __future__ import division
  2. import boto3
  3. import os
  4. import datetime
  5.  
  6. def lambda_handler(event, context):
  7.  
  8. date = str(datetime.date.today())
  9. Ofile = open('/tmp/zinst.out', "w")
  10. Sns = boto3.client('sns')
  11. ssm = boto3.client('ssm')
  12. Subj = os.environ['Subj']
  13. ETopicArn = os.environ['ETopicArn']
  14. RegionList = boto3.session.Session().get_available_regions('ec2')
  15. for Region in RegionList:
  16. ec = boto3.client('ec2', Region)
  17. Conn = boto3.client('ec2', region_name=Region)
  18.  
  19. AllReserves = Conn.describe_instances()
  20. for Reserves in AllReserves['Reservations']:
  21. for Inst in Reserves['Instances']:
  22. tags=(Inst['Tags'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement