Skip to content

Commit 559b115

Browse files
docs: Add syntax highlighting, fix typos, other cleanups (#82)
* Add missing backslash in docker command * Remove stray "`" from command * Covert code snippet to code block for consistency * Remove extraneous newline * Fix invalid italics and use "_" for consistency * Change (invalid) italics to header Make it consistent with the preceding section that says: "To build the emulator into your image" Also, the stray whitespace before the final asterisk was incorrect. * Add syntax highlighting to code blocks * Add header to content table
1 parent 6c827ea commit 559b115

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

README.md

+16-13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Lambda’s orchestrator, or security and authentication configurations. You can
2222
* [Build RIE into your base image](#build-rie-into-your-base-image)
2323
* [To build the emulator into your image](#to-build-the-emulator-into-your-image)
2424
* [Test an image without adding RIE to the image](#test-an-image-without-adding-rie-to-the-image)
25+
* [To test an image without adding RIE to the image](#to-test-an-image-without-adding-rie-to-the-image)
2526
* [How to configure](#how-to-configure)
2627
* [Level of support](#level-of-support)
2728
* [Security](#security)
@@ -79,7 +80,7 @@ You can build RIE into a base image. Download the RIE from GitHub to your local
7980

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

82-
```
83+
```sh
8384
#!/bin/sh
8485
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
8586
exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric
@@ -94,38 +95,39 @@ You can build RIE into a base image. Download the RIE from GitHub to your local
9495

9596
To use the default x86\_64 architecture
9697

97-
```
98+
```dockerfile
9899
ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
99100
ENTRYPOINT [ "/entry_script.sh" ]
100101
```
101102

102103
To use the arm64 architecture:
103104

104-
```
105+
```dockerfile
105106
ADD aws-lambda-rie-arm64 /usr/local/bin/aws-lambda-rie
106107
ENTRYPOINT [ "/entry_script.sh" ]
107108
```
108109

109110
4. Build your image locally using the docker build command.
110111

111-
```
112+
```sh
112113
docker build -t myfunction:latest .
113114
```
114115

115116
5. Run your image locally using the docker run command.
116117

117-
```
118+
```sh
118119
docker run -p 9000:8080 myfunction:latest
119120
```
120121

121122
### Test an image without adding RIE to the image
122123

123124
You install the runtime interface emulator to your local machine. When you run the container image, you set the entry point to be the emulator.
124-
*To test an image without adding RIE to the image *
125+
126+
#### To test an image without adding RIE to the image
125127

126128
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.
127129

128-
```
130+
```sh
129131
mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \
130132
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
131133
&& chmod +x ~/.aws-lambda-rie/aws-lambda-rie
@@ -139,16 +141,18 @@ You install the runtime interface emulator to your local machine. When you run t
139141

140142
2. Run your Lambda image function using the docker run command.
141143

142-
```
143-
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest
144-
--entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>`
144+
```sh
145+
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest \
146+
--entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>
145147
```
146148

147149
This runs the image as a container and starts up an endpoint locally at `localhost:9000/2015-03-31/functions/function/invocations`.
148150

149151
3. Post an event to the following endpoint using a curl command:
150152

151-
`curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'`
153+
```sh
154+
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
155+
```
152156

153157
This command invokes the function running in the container image and returns a response.
154158

@@ -173,10 +177,9 @@ The rest of these Environment Variables can be set to match AWS Lambda's environ
173177
You can use the emulator to test if your function code is compatible with the Lambda environment, executes successfully
174178
and provides the expected output. For example, you can mock test events from different event sources. You can also use
175179
it to test extensions and agents built into the container image against the Lambda Extensions API. This component
176-
does *not *emulate* *the orchestration behavior of AWS Lambda. For example, Lambda has a network and security
180+
does _not_ emulate the orchestration behavior of AWS Lambda. For example, Lambda has a network and security
177181
configurations that will not be emulated by this component.
178182
179-
180183
* You can use the emulator to test if your function code is compatible with the Lambda environment, runs successfully and provides the expected output.
181184
* You can also use it to test extensions and agents built into the container image against the Lambda Extensions API.
182185
* This component does _not_ emulate Lambda’s orchestration, or security and authentication configurations.

0 commit comments

Comments
 (0)