Skip to content

Experimental AWS Lambda function to build an ESPHome firmware quickly cheaply in the cloud

License

Notifications You must be signed in to change notification settings

konnected-io/esphome-lambda-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esphome-lambda-build

Experimental AWS Lambda function to build an ESPHome firmware quickly cheaply in the cloud. The idea is to trigger a lambda function with a path to an ESPHome config file, and build the firmware on AWS Lambda and drop the resulting bin file(s) in S3.

WARNING: This does not work!

I ran into a blocking issue related to the virtual environment creaded by PlatformIO core during the build. It almost works though! The build actually succeeds but can't get past an apparent path issue with esptool.py. Publishing this here in case anyone comes across this with a solution.

Lambda function config

These are lambda parameters used

  • Runtime: Python 3.12
  • Handler: build.handler
  • Architecture: x86_64
  • Memory: 4GB
  • Ephemeral Storage: 4GB

Layers

Use the build_layer.sh to install Python dependencies on a similar x86_64 runtime. I used an EC2 instance to do this. Upload the created layer.zip as a custom layer.

Also required:

  • git-lambda2: arn:aws:lambda:us-east-1:553035198032:layer:git-lambda2:8

Environment variables

Not sure about all of these.

  • PLATFORMIO_CORE_DIR: /tmp/.platformio
  • PLATFORMIO_DISABLE_COLOR: true
  • PLATFORMIO_DISABLE_PROGRESSBAR: true
  • PYTHONEXEPATH: python3
  • PYTHONPATH: /opt/python

Test

Test with the following event JSON:

{
  "config_url": "https://raw.githubusercontent.com/konnected-io/esphome-lambda-build/main/simple-test.yaml"
}

About

Experimental AWS Lambda function to build an ESPHome firmware quickly cheaply in the cloud

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published