I wrote the process to stop the AWS instance in Boto3. I would like to get the tag, get the list, stop it in a group, stop it using Lambda, and so on.
I made it so much, so I will post it on my blog.
# -*- coding: utf-8 -*-
# import
import boto3
from boto3.session import Session
ec2 = boto3.client('ec2')
InstanceId = 'Instance ID'
# def
def ec2_stop():
response = ec2.stop_instances(
InstanceIds=[
InstanceId
]
)
# Main
if __name__ == "__main__":
ec2_stop()
https://github.com/handa3/study/blob/master/aws/ec2/stop.py
Recommended Posts