BaySec website source
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
704 B

  1. import boto.cloudfront
  2. import os
  3. import time
  4. if __name__ == '__main__':
  5. key = os.environ['AWS_ACCESS_KEY_ID']
  6. secret = os.environ['AWS_SECRET_ACCESS_KEY']
  7. distid = os.environ['BAYSEC_DISTID']
  8. c = boto.cloudfront.CloudFrontConnection(key, secret)
  9. #help(c)
  10. #print(list(c.get_invalidation_requests(distid)))
  11. iq = c.create_invalidation_request(distid, [ '/*' ])
  12. iqid = iq.id
  13. print('invalidation id:', iqid)
  14. for i in range(20):
  15. if iq.status == 'Completed':
  16. print('Done')
  17. break
  18. print('checking...')
  19. time.sleep(5)
  20. iq = c.invalidation_request_status(distid, iqid)
  21. else:
  22. print('failed, c is connection, iq is last request, iqid is Id of request')
  23. import pdb
  24. pdb.set_trace()