SD
def getAppInstanceId():
ec2 = boto3.client('ec2')
return ec2.describe_instances(
Filters=[
{
'Name': 'tag:Name',
'Values': ['app']
}
]
)['Reservations'][0]['Instances'][0]['ImageId']
def restartAppInstance(id):
ec2 = boto3.client('ec2')
ec2.reboot_instances(
InstanceIds = [id]
)
restartAppInstance(getAppInstanceId())