Skip to content

Instantly share code, notes, and snippets.

View iamwarning's full-sized avatar
🐘
Working from home

[ I am warning ] iamwarning

🐘
Working from home
View GitHub Profile
@iamwarning
iamwarning / lambda-aws-ssm-run-command-on-ec2-instance.py
Created April 26, 2022 17:26 — forked from lrakai/lambda-aws-ssm-run-command-on-ec2-instance.py
Run commands on EC2 instances using Lambda and Systems Manager (SendCommand)
import boto3
import botocore
import time
def handler(event=None, context=None):
client = boto3.client('ssm')
instance_id = 'i-07362a00952fca213' # hard-code for example
response = client.send_command(