Skip to content

Fix & improve formatting in Readme #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ You can build RIE into a base image. Download the RIE from GitHub to your local

1. Create a script and save it in your project directory. Set execution permissions for the script file.

The script checks for the presence of the `AWS_LAMBDA_RUNTIME_API` environment variable, which indicates the presence of the runtime API. If the runtime API is present, the script runs [the runtime interface client](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client). Otherwise, the script runs the runtime interface emulator.
The script checks for the presence of the `AWS_LAMBDA_RUNTIME_API` environment variable, which indicates the presence of the runtime API. If the runtime API is present, the script runs [the runtime interface client](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client). Otherwise, the script runs the runtime interface emulator.

The following example shows a typical script for a Node.js function.
```
The following example shows a typical script for a Node.js function.

```sh
#!/bin/sh
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric
Expand All @@ -75,25 +76,25 @@ The following example shows a typical script for a Node.js function.

3. Install the emulator package and change `ENTRYPOINT` to run the new script by adding the following lines to your Dockerfile:

To use the default x86\_64 architecture
```
To use the default x86\_64 architecture
```dockerfile
ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
ENTRYPOINT [ "/entry_script.sh" ]
```

To use the arm64 architecture:
```
To use the arm64 architecture:
```dockerfile
ADD aws-lambda-rie-arm64 /usr/local/bin/aws-lambda-rie
ENTRYPOINT [ "/entry_script.sh" ]
```

4. Build your image locally using the docker build command.
```
```sh
docker build -t myfunction:latest .
```

5. Run your image locally using the docker run command.
```
```sh
docker run -p 9000:8080 myfunction:latest
```

Expand All @@ -104,19 +105,19 @@ You install the runtime interface emulator to your local machine. When you run t

1. From your project directory, run the following command to download the RIE (x86-64 architecture) from GitHub and install it on your local machine.

```
```sh
mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
&& chmod +x ~/.aws-lambda-rie/aws-lambda-rie
```

To download the RIE for arm64 architecture, use the previous command with a different GitHub download url.
To download the RIE for arm64 architecture, use the previous command with a different GitHub download url.
```
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 \
```

2. Run your Lambda image function using the docker run command.
```
```sh
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest
--entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it ;)

Suggested change
--entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>`
--entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>

```
Expand Down