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 == 'mefJitsi3':

print('not found')

keys = manager.get_all_sshkeys()
droplet = digitalocean.Droplet(token="token",
                               region='fra1', # Amster
                               image='58038226', # Ubuntu 14.04 x64
                               size_slug='s-1vcpu-1gb',  # 512MB
                               ssh_keys=keys, #Automatic conversion
droplet.create() # code stucks here

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Looks like the issue could be in the Lambda execution environment or some limitations around running asynchronous calls. Might be worth checking out the local python debugging tools for Lambda: