Skip to content

Instantly share code, notes, and snippets.

View Sarankumar18's full-sized avatar
🎯
Focusing

Sarankumar Baskar Sarankumar18

🎯
Focusing
View GitHub Profile
@Sarankumar18
Sarankumar18 / lambda-aws-ssm-run-command-on-ec2-instance.py
Created December 25, 2022 12:43 — 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(