Skip to content

Instantly share code, notes, and snippets.

@mejedi
Last active June 1, 2022 11:29
Show Gist options
  • Save mejedi/686ec3415e1d3038be8c7a0d17e2e982 to your computer and use it in GitHub Desktop.
Save mejedi/686ec3415e1d3038be8c7a0d17e2e982 to your computer and use it in GitHub Desktop.
Running QEMU in AWS Lambda

A humble test to benchmark QEMU as an engine to run untrusted code in AWS Lambda.

One can invoke ./run.sh locally to ensure that everything works as expected before deploying the container image to AWS Lambda.

FROM alpine:latest AS builder
RUN apk update && apk add git cmake build-base curl-dev libexecinfo-dev
WORKDIR /root
RUN git clone https://github.com/mejedi/vmwrap.git vmwrap.git
RUN cd vmwrap.git \
&& make \
&& DESTDIR=/root/dist make install
COPY vmwrap-kernel-default dist/usr/lib/vmwrap/kernel/default
RUN git clone https://github.com/awslabs/aws-lambda-cpp.git aws-lambda-cpp.git
RUN cd aws-lambda-cpp.git \
&& mkdir build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/aws-lambda-cpp \
&& make && make install
COPY timing_test.cpp timing_test.cpp
RUN g++ timing_test.cpp -I aws-lambda-cpp/include/ -L aws-lambda-cpp/lib/ -laws-lambda-runtime -lcurl -o /root/dist/timing_test
COPY m.lua t.sh dist/
FROM alpine:latest
RUN apk add luajit qemu-system-x86_64 libstdc++ libcurl
COPY --from=builder /root/dist /
ENTRYPOINT [ "/timing_test" ]
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment