简体   繁体   English

如何将 AWS Lambda 连接到 DAX?

[英]How To Connect AWS Lambda to DAX?

I am using AWS API gateway, Lambda services, and DynamoDB for my application.我正在为我的应用程序使用 AWS API 网关、Lambda 服务和 DynamoDB。 I wish to use DynamoDB Accelerator(DAX) to increase the performance.我希望使用 DynamoDB Accelerator(DAX) 来提高性能。 The documents are telling to create a DAX cluster, and a VPC and add both DAX cluster and lambda to VPC.这些文档告诉我们要创建一个 DAX 集群和一个 VPC,并将 DAX 集群和 lambda 添加到 VPC。 Its all a bit confusing.这有点令人困惑。 Can anyone please give a detailed information on the steps to be followed?任何人都可以提供有关要遵循的步骤的详细信息吗?

DynamoDB Accelerator (DAX) is used as a caching layer 'in front' of DynamoDB. DynamoDB Accelerator (DAX) 用作 DynamoDB“前面”的缓存层。

Since DAX is launched inside an Amazon VPC, the steps would be:由于 DAX 在 Amazon VPC 内启动,因此步骤如下:

  • Create an Amazon VPC, or use an existing VPC创建 Amazon VPC,或使用现有 VPC
  • Launch a DAX cluster in the VPC (preferably a private subnet, for improved security)在 VPC 中启动 DAX 集群(最好是私有子网,以提高安全性)

Applications can then access DynamoDB via DAX to take advantage of caching:然后应用程序可以通过 DAX 访问 DynamoDB 以利用缓存:

DAX 概览

Instead of having an application access DAX, you appear to want to use it from an AWS Lambda function.您似乎希望从 AWS Lambda 函数中使用它,而不是让应用程序访问 DAX。 In this case, your AWS Lambda function should be configured to connect to the same VPC (preferably connected to a private subnet).在这种情况下,您的 AWS Lambda 函数应配置为连接到同一个 VPC(最好连接到私有子网)。

The Lambda function will then be able to access the DAX cluster within the VPC.然后,Lambda 函数将能够访问 VPC 内的 DAX 集群。 DAX itself will then connect to DynamoDB.然后 DAX 本身将连接到 DynamoDB。 (If the DAX cluster is in a private subnet, this will require either a NAT Gateway or a VPC Endpoint to be able to access DynamoDB from the VPC.) (如果 DAX 集群位于私有子网中,则需要 NAT 网关或 VPC 终端节点才能从 VPC 访问 DynamoDB。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM