Skip to content

Instantly share code, notes, and snippets.

#md64.json -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu-14.04-amd64"
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
config.vm.provision "chef_client" do |chef|
chef.chef_server_url = "https://api.chef.io/organizations/mydemoorg"
chef.validation_key_path = "/Users/me/Google Drive/Chef/My Demo Org/chef-repo/.chef/mydemoorg-validator.pem"
chef.validation_client_name = "mydemoorg-validator"
import boto3
from datetime import datetime
iam_client = boto3.client('iam')
iam_resource = boto3.resource('iam')
def get_UsersOlderThan(days):
''' Returns list of users whose PasswordLastUsed
is greater than <days> ago.
# This will shut down all instances in all regions at 17:30
import boto3.ec2
from datetime import datetime
import time
region_list = []
if __name__ == "__main__":
@stevear22
stevear22 / AWS-boto3_tag_volumes_to_match_instance.py
Created February 11, 2016 23:29
AWS (Boto3) find EC2 instances and change tags on attached EBS volumes to match
import boto3
region_list = ['us-west-1', 'us-west-2']
for region in region_list:
print 'REGION:', region
ec2 = boto3.resource('ec2', region)
for instance in ec2.instances.all():
print ' instance:', instance
ec2tags = instance.tags