Question
How to create droplet in aws lambda
I am trying to implement a lambda function that creates a droplet. However, after the creation line of code, lambda stucks, and timeouts. In addition, in most of cases, it cannot create a droplet. The result is the same even I have extended the timeout range. Also, it means lots of billing from aws. I am running the same code in local python (in my laptop), there is no problem. What can I do? here is the code:
import digitalocean
manager = digitalocean.Manager(token="token")
my_droplets = manager.get_all_droplets()
for droplet in my_droplets:
d = droplet.load()
if d.name == 'mefJitsi3':
print('found')
print(d.ip_address)
exit()
#print(my_droplets)
print('not found')
keys = manager.get_all_sshkeys()
droplet = digitalocean.Droplet(token="token",
name='mefJitsi3',
region='fra1', # Amster
image='58038226', # Ubuntu 14.04 x64
size_slug='s-1vcpu-1gb', # 512MB
ssh_keys=keys, #Automatic conversion
backups=False)
droplet.create() # code stucks here
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×