Lambda demo functions for Server Stop/Start/Status

This commit is contained in:
Torsten 2024-04-07 08:29:43 +02:00
parent 3436132866
commit 8f62d9bf83
5 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,15 @@
```python
#StopServer
import boto3
region = 'eu-central-1'
#instances = ['i-0de7cce6fcdf8c0e6']
ec2 = boto3.client('ec2', region_name=region)
def lambda_handler(event, context):
ec2.stop_instances(InstanceIds=["i-0de7cce6fcdf8c0e6"])
return {
'message' : 'stopped'
}
```
`