You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2020. It is now read-only.
This container image converter tool (img2lambda) repackages container images (such as Docker images) into AWS Lambda layers, and publishes them as new layer versions to Lambda.
5
+
This container image converter tool (img2lambda) extracts an AWS Lambda function deployment package from a container image (such as a Docker image).
6
+
It also extracts AWS Lambda layers from a container image, and publishes them as new layer versions to Lambda.
6
7
7
-
The tool copies all files under '/opt' in the Docker image, maintaining the individual Docker image layers as individual Lambda layers. The published layer ARNs will be stored in a file 'output/layers.json', which can be used as input when creating Lambda functions. Each layer is named using a "namespace" prefix (like img2lambda or my-docker-image) and the SHA256 digest of the Docker image layer, in order to provide a way of tracking the provenance of the Lambda layer back to the Docker image that created it.
8
+

8
9
9
-
If a layer is already published to Lambda (same layer name, SHA256 digest, and size), it will not be published again. Instead the existing layer version ARN will be written to the output file.
10
+
To extract a Lambda function deployment package, the tool copies all files under '/var/task' in the container image into a deployment package zip file.
10
11
11
-

12
+
To extract Lambda layers, the tool copies all files under '/opt' in the container image, repackaging the individual container image layers as individual Lambda layer zip files.
13
+
The published layer ARNs are stored in a file 'output/layers.json', which can be used as input when creating Lambda functions.
14
+
Each layer is named using a "namespace" prefix (like 'img2lambda' or 'my-docker-image') and the SHA256 digest of the container image layer, in order to provide a way of tracking the provenance of the Lambda layer back to the container image that created it.
15
+
If a layer is already published to Lambda (same layer name, SHA256 digest, and size), it will not be published again.
16
+
Instead the existing layer version ARN will be written to the output file.
12
17
13
18
**Table of Contents**
14
19
@@ -41,7 +46,7 @@ GLOBAL OPTIONS:
41
46
--image-type value, -t value Type of the source container image. Valid values: 'docker' (Docker image from the local Docker daemon), 'oci' (OCI image archive at the given path and optional tag) (default: "docker")
42
47
--region value, -r value AWS region (default: "us-east-1")
43
48
--profile value, -p value AWS credentials profile. Credentials will default to the same chain as the AWS CLI: environment variables, default profile, container credentials, EC2 instance credentials
44
-
--output-directory value, -o value Destination directory for command output (default: "./output")
49
+
--output-directory value, -o value Destination directory for output: function deployment package (function.zip) and list of published layers (layers.json, layers.yaml) (default: "./output")
45
50
--layer-namespace value, -n value Prefix for the layers published to Lambda (default: "img2lambda")
46
51
--dry-run, -d Conduct a dry-run: Repackage the image, but only write the Lambda layers to local disk (do not publish to Lambda)
47
52
--description value, --desc value The description of this layer version (default: "created by img2lambda from image <name of the image>")
@@ -124,21 +129,21 @@ For example:
124
129
125
130
### Docker Example
126
131
127
-
Build the example Docker image to create a PHP Lambda custom runtime:
132
+
Build the example Docker image to create a PHP Lambda custom runtime and Hello World PHP function:
128
133
```
129
134
cd example
130
135
131
136
docker build -t lambda-php .
132
137
```
133
138
134
-
The example PHP functions are also built into the example image, so they can be run with Docker:
139
+
The Hello World function can be invoked locally by running the Docker image:
135
140
```
136
141
docker run lambda-php hello '{"name": "World"}'
137
142
138
143
docker run lambda-php goodbye '{"name": "World"}'
139
144
```
140
145
141
-
Run the tool to create and publish Lambda layers that contain the PHP custom runtime:
146
+
Run the tool to both create a Lambda deployment package that contains the Hello World PHP function, and to create and publish Lambda layers that contain the PHP custom runtime:
Run the tool to create and publish Lambda layers that contain the PHP custom runtime:
162
+
Run the tool to both create a Lambda deployment package that contains the Hello World PHP function, and to create and publish Lambda layers that contain the PHP custom runtime:
app.Usage="Repackages a container image into AWS Lambda layers and publishes them to Lambda"
26
+
app.Usage="Repackages a container image into an AWS Lambda function deployment package. Extracts AWS Lambda layers from the image and publishes them to Lambda"
27
27
app.Action=func(c*cli.Context) error {
28
28
// parse and store the passed runtime list into the options object
0 commit comments