Skip to content

Commit 30b4a42

Browse files
committed
Added Makefile and README
1 parent 0943efb commit 30b4a42

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MYSQL_VERSION = 8.0.18
2+
3+
all: mysql-$(MYSQL_VERSION)-layer.zip mariadb-layer.zip
4+
5+
mysql: mysql-$(MYSQL_VERSION)-layer.zip
6+
mariadb: mariadb-layer.zip
7+
8+
mysql-$(MYSQL_VERSION)-layer.zip:
9+
docker build -f Dockerfile.mysql . -t mysql-layer --build-arg VERSION=$(MYSQL_VERSION)
10+
docker container cp $(shell docker container create mysql-layer):/root/mysql-$(MYSQL_VERSION)-layer.zip .
11+
12+
mariadb-layer.zip:
13+
docker build -f Dockerfile.mariadb . -t mariadb-layer
14+
docker container cp $(shell docker container create mariadb-layer):/root/mariadb-layer.zip .
15+
16+
clean:
17+
rm -f *.zip
18+

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# AWS Lambda Layers for MySQL and MariaDB commands
2+
3+
These layers add the `mysql` client commands in the form of a layer to be used with [AWS Lambda](https://aws.amazon.com/lambda/).
4+
5+
This is useful for Lambda functions that need to run MySQL commands to quickly import data to a RDS server, for example. It can be easier than using the MySQL API in the language of your choice. Particularly useful in coordination with a [Bash lambda](https://github.com/gkrizek/bash-lambda-layer) layer.
6+
7+
The layers (in the form of zip files) are built in Docker using the official AmazonLinux image, to match the typicial Lambda runtime environment.
8+
9+
- The MySQL layer is built from the official source (v8.0.18)
10+
- THe MariaDB layer is built from files in the official `mariadb` AmazonLinux package.
11+
12+
## Download
13+
14+
Pre-built zip archives that can be uploaded to your AWS account are available on the [releases](https://github.com/megastep/mysql-lambda/releases) page.
15+
16+
## Building the layers
17+
18+
If you have a working Docker setup, you just need to enter `make` to build both the MySQL and MariaDB layers. Alternatively:
19+
20+
- `make mysql` builds the MySQL variant from source.
21+
- `make mariadb` builds the MariaDB variant from the pre-built packages.
22+
23+
Note that the MySQL 8.0 variant takes considerably longer to build from source.
24+
25+
26+
### Author
27+
28+
[Stephane Peter](https://stephanepeter.com/) (@megastep) - [Sponsor me!](https://github.com/sponsors/megastep)

0 commit comments

Comments
 (0)