Skip to content

Instantly share code, notes, and snippets.

@Simoneth
Created February 2, 2023 09:20
Show Gist options
  • Save Simoneth/f254781489e94ccf4dcc83d4efd09129 to your computer and use it in GitHub Desktop.
Save Simoneth/f254781489e94ccf4dcc83d4efd09129 to your computer and use it in GitHub Desktop.
Create Lambda layer
[Steps to create magic-dependencies-layer]
1. Launch an EC2 with Amazon Linux 2 OS.
2. SSH into EC2 instance.
Let me share the commands I’ve used to create layer in this EC2 instance.
> cd ~
> mkdir magic
> cd magic
> mkdir lib # this directory must be called 'lib'
# Since this EC2 instance already has libmagic.so dependencies(Unlike Lambda), We’ll just copy related dependencies to our layer file.
> cp /usr/lib64/libmagic.so.1 lib
> cp /usr/lib64/libmagic.so.1.0.0 lib
> cp /usr/share/misc/magic .
# At this point, the directory should look like
ㄴ lib
ㄴ libmagic.so.1
ㄴ libmagic.so.1.0.0
ㄴ magic
# Create .zip file.
> cd ~/magic/
> zip -r lambda-layer.zip .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment