Create a Zip archive using macOS Terminal

Two popular ways to package files for AWS Lambda.

Create a Zip archive using macOS Terminal


This example shows how to recursively compress files into a zip folder and exclude items such as package.json, npm.log, and ReadMe.mdfiles.

-r Recursively include all files within folder
-x "package.json" means to exclude any files with this name
.* means to exclude any hidden files such as .DS_Store
-x *.md means to exclude anything with a .md extension

zip -r my_zip_package * -x .* -x "package.json" -x "*.md"


Unzip a .zip file.

unzip -d /path/to/directory

Next Steps

Now that we've gone over the basic commands, our next step should be to create scripts that can help us automate the process of packaging and publishing our code to Lambda.

My article on Managing AWS Commands using JakeJS will show you how I package all of my Lambda functions for deployment into a single script.