daily log 11.10.19

1 minute read

Here’s how it went:

  1. Tried to run my python function using lambdas.
  2. Couldn’t because I cannot contact the internet from PYTHON CODE DUH.
  3. But maybe, I could hit a node lambda?
  4. Anyway, I then made a flask app.
  5. OH WAIT I FORGOT THAT I FIRST TRIED TO DO ALL OF THIS WITH NODE AND SPAWN CHILD PROCESS
  6. Flask app is great working swell got it to heroku amazing yay
  7. Want to get it to AWS because I’m a masochist?
  8. Cannot figure out how to include NLTK downloads to save my life.
  9. Back to lambdas. And please start back at 1.

POTENTIAL SOLUTIONS:

  1. JUST GIVE UP ON AWS: nope. Too stubborn and I love how I can automate it (eventually)
  2. Lambdas… again? Maybe hitting a node lambda??
  3. Continue tugging on the EC2 virtual machine thread. I will be entering my double digit hours on this thread.

So I started pulling on thread 2:

  1. Python lambda working!
  2. Node lambda also working!
  3. When Python lambda hits node lambda, they work together!
  4. EXCEPT I CANNOT DO A SINGLE FREAKING HTTP REQUEST

AFTERNOON UPDATE:

  1. NODE lambda (sendsHtml) is correctly “sending” html https://dijvc4fq4e.execute-api.us-west-2.amazonaws.com/default/sendsHtml
  2. PYTHON lambda (my-function) is correctly “receiving” html https://61w53gm2s7.execute-api.us-west-2.amazonaws.com/default/my-function

NOTE: BOTH are being uploaded to AWS (e.g. not inside the lambda console) via

zip -g function.zip lambda_function.py

and

aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip

QUESTION:

Why does python code take so long to run on lambdas

INSTALLING NEW PACKAGES FOR LAMBDA:

source v-env/bin/activate
pip install `package` 
deactivate
cd v-env/lib/python3.7/site-packages
zip -r9 ${OLDPWD}/function.zip .
cd $OLDPWD
zip -g function.zip lambda_function.py
aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip

Updated: