diff --git a/docs/src/main/asciidoc/adapters/aws.adoc b/docs/src/main/asciidoc/adapters/aws.adoc
index 6ab00adc4..39d4bc9f2 100644
--- a/docs/src/main/asciidoc/adapters/aws.adoc
+++ b/docs/src/main/asciidoc/adapters/aws.adoc
@@ -57,10 +57,32 @@ For example, to deploy behind an API Gateway, use `--handler org.springframework
== Custom Runtime
-An https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html[AWS Lambda custom runtime] can be created really easily using the HTTP export features in Spring Cloud Function Web. To make this work just add Spring Cloud Function AWS and Spring Cloud Function Web as dependencies in your project and set the following in your `application.properties`:
+You can also benefit from https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html[AWS Lambda custom runtime] feature of AWS Lambda
+and Spring Cloud Function provides all the necessary components to make it easy.
-```
-spring.cloud.function.web.export.enabled=true
-```
+From the code perspective the application should look no different then any other Spring Cloud Function application.
+The only thing you need to do is to provide a `bootstrap` script in the root of your zip/jar that runs the Spring Boot application.
+and select "Custom Runtime" when creating a function in AWS.
+Here is an example 'bootstrap' file:
+```text
+#!/bin/sh
-Set the handler name in AWS to the name of your function. Then provide a `bootstrap` script in the root of your zip/jar that runs the Spring Boot application. The functional bean definition style works for custom runtimes too, and is faster than the `@Bean` style, so the example `FuncApplication` above would work. A custom runtime can start up much quicker even than a functional bean implementation of a Java lambda - it depends mostly on the number of classes you need to load at runtime. Spring doesn't do very much here, so you can reduce the cold start time by only using primitive types in your function, for instance, and not doing any work in custom `@PostConstruct` initializers.
+cd ${LAMBDA_TASK_ROOT:-.}
+
+java -Dspring.main.web-application-type=none -Dspring.jmx.enabled=false \
+ -noverify -XX:TieredStopAtLevel=1 -Xss256K -XX:MaxMetaspaceSize=128M \
+ -Djava.security.egd=file:/dev/./urandom \
+ -cp .:`echo lib/*.jar | tr ' ' :` com.example.LambdaApplication
+```
+The `com.example.LambdaApplication` represents your application which contains function beans.
+
+Set the handler name in AWS to the name of your function. You can use function composition here as well (e.g., `uppecrase|reverse`).
+That is pretty much all. Once you upload your zip/jar to AWS your function will run in custom runtime.
+We provide a https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-aws-custom-new[sample project]
+where you can also see how to configure yoru POM to properly generate the zip file.
+
+The functional bean definition style works for custom runtimes as well, and is
+faster than the `@Bean` style. A custom runtime can start up much quicker even than a functional bean implementation
+of a Java lambda - it depends mostly on the number of classes you need to load at runtime.
+Spring doesn't do very much here, so you can reduce the cold start time by only using primitive types in your function, for instance,
+and not doing any work in custom `@PostConstruct` initializers.
diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml
index 630424bb1..69db08059 100644
--- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml
+++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml
@@ -42,12 +42,6 @@
org.springframeworkspring-web
-
-
- com.fasterxml.jackson.core
- jackson-databind
- org.springframework.bootspring-boot-starter
@@ -93,10 +87,6 @@
true
-
- io.projectreactor
- reactor-core
- org.springframework.bootspring-boot-starter-test
diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/AWSLambdaUtils.java b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/AWSLambdaUtils.java
new file mode 100644
index 000000000..7eef6764f
--- /dev/null
+++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/AWSLambdaUtils.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2021-2021 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.function.adapter.aws;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.amazonaws.services.lambda.runtime.Context;
+import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.cloud.function.context.catalog.FunctionTypeUtils;
+import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
+import org.springframework.cloud.function.json.JsonMapper;
+import org.springframework.http.HttpStatus;
+import org.springframework.lang.Nullable;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageHeaders;
+import org.springframework.messaging.support.MessageBuilder;
+import org.springframework.util.Assert;
+
+/**
+ *
+ * @author Oleg Zhurakousky
+ *
+ */
+final class AWSLambdaUtils {
+
+ private static Log logger = LogFactory.getLog(AWSLambdaUtils.class);
+
+ private AWSLambdaUtils() {
+
+ }
+
+ public static Message generateMessage(byte[] payload, MessageHeaders headers,
+ FunctionInvocationWrapper function, JsonMapper mapper) {
+ return generateMessage(payload, headers, function, mapper, null);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public static Message generateMessage(byte[] payload, MessageHeaders headers,
+ FunctionInvocationWrapper function, JsonMapper mapper, @Nullable Context awsContext) {
+
+ if (logger.isInfoEnabled()) {
+ logger.info("Incoming JSON for ApiGateway Event: " + new String(payload));
+ }
+
+ MessageBuilder messageBuilder = null;
+ Object request = mapper.fromJson(payload, Object.class);
+ Type inputType = function.getInputType();
+ if (FunctionTypeUtils.isMessage(inputType)) {
+ inputType = FunctionTypeUtils.getImmediateGenericType(inputType, 0);
+ }
+ boolean mapInputType = (inputType instanceof ParameterizedType && ((Class>) ((ParameterizedType) inputType).getRawType()).isAssignableFrom(Map.class));
+ if (request instanceof Map) {
+ Map requestMap = (Map) request;
+ if (requestMap.containsKey("Records")) {
+ List