

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用创建 CloudFormation 要在 Neptune 中使用的 Lambda 函数
<a name="get-started-cfn-lambda"></a>

您可以使用 CloudFormation 模板来创建可以访问 Neptune 的 AWS Lambda 函数。

1. 要在 CloudFormation 控制台上启动 Lambda 函数堆栈，请选择下表中的**启动堆栈**按钮之一。    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/neptune/latest/userguide/get-started-cfn-lambda.html)

1.  在 **Select Template** 页面上，选择 **Next**。

1. 在**指定详细信息**页面上，设置以下选项：

   1. 根据您要在 lambda 函数中使用的语言，选择 lambda 运行时系统。这些 CloudFormation 模板目前支持以下语言：
      + **Python 3.9**（映射到 Amazon S3 URL 中的 `python39`）
      + **NodeJS 18**（映射到 Amazon S3 URL 中的 `nodejs18x`）
      + **Ruby 2.5**（映射到 Amazon S3 URL 中的 `ruby25`）

   1. 提供相应的 Neptune 集群端点和端口号。

   1. 提供相应的 Neptune 安全组。

   1. 提供相应的 Neptune 子网参数。

1. 选择**下一步**。

1. 在**选项**页面上，选择**下一步**。

1. 在**审核**页面上，选中第一个复选框以确认 CloudFormation 将创建 IAM 资源。

   然后选择**创建**。

如果您需要对 lambda 运行时系统进行自己的更改，则可以从您区域中的 Amazon S3 位置下载一个通用的运行时系统：

```
https://s3.Amazon region.amazonaws.com/aws-neptune-customer-samples-Amazon region/lambda/runtime-language/lambda_function.zip.
```

例如：

```
https://s3.us-west-2.amazonaws.com/aws-neptune-customer-samples-us-west-2/lambda/python36/lambda_function.zip
```