Skip to content

Instantly share code, notes, and snippets.

@rh917
rh917 / EC2-Stopped-Tagged-Lambda.py
Created March 28, 2018 03:15 — forked from mlapida/EC2-Stopped-Tagged-Lambda.py
Using a lambda function, stop all instances that are tagged appropriately.
import boto3
import logging
#setup simple logging for INFO
logger = logging.getLogger()
logger.setLevel(logging.INFO)
#define the connection
ec2 = boto3.resource('ec2')