简体   繁体   English

将 AWS Lambda 与 Aurora Serverless 相结合

[英]Combine AWS Lambda with Aurora Serverless

Is it possible to access Aurora Serverless DB from AWS Lambda?是否可以从 AWS Lambda 访问 Aurora Serverless DB?

In my case I have a Flutter mobile application which is communicating with Lumen micro framework through RESTful API.就我而言,我有一个 Flutter 移动应用程序,它通过 RESTful API 与 Lumen 微框架进行通信。 For DB I use MySQL.对于 DB,我使用 MySQL。

After creating AWS Aurora cluster, can I connect to it like to a normal MySQL DB connection?创建 AWS Aurora 集群后,我可以像普通的 MySQL DB 连接一样连接它吗?

DB_CONNECTION=mysql
DB_HOST=my.awshost.com
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

I am relatively new to AWS.我对 AWS 比较陌生。 I've been only using EC2 so far.到目前为止,我一直只使用 EC2。 Therefore, I am trying to getting more familiar with Serverless concept.因此,我正在尝试更熟悉 Serverless 的概念。

Any help is appreciated.任何帮助表示赞赏。

Yes, you can access like other service but there is limitation of Serverless DB, it can only accessible within VPC, so you should define Lambda in the same VPC and configure networking.是的,您可以像其他服务一样访问,但 Serverless DB 存在限制,它只能在 VPC 内访问,因此您应该在同一 VPC 中定义 Lambda 并配置网络。

Limitations of Aurora Serverless Aurora Serverless 的限制

  • Aurora with MySQL version 5.6 compatibility极光与MySQL 5.6版兼容性

  • Aurora with PostgreSQL version 10.7 compatibility极光与PostgreSQL 10.7版本兼容

  • The port number for connections must be:连接的端口号必须是:

3306 for Aurora MySQL

5432 for Aurora PostgreSQL
  • You can't give an Aurora Serverless DB cluster a public IP address.您不能为Aurora Serverless 数据库集群提供公共 IP 地址。 You can access an Aurora Serverless DB cluster only from within a virtual private cloud (VPC) based on the Amazon VPC service.只能从基于 Amazon VPC 服务的虚拟私有云 (VPC)中访问 Aurora Serverless 数据库集群。

  • Each Aurora Serverless DB cluster requires two AWS PrivateLink endpoints.每个 Aurora Serverless 数据库集群需要两个 AWS PrivateLink 终端节点。 If you reach the limit for PrivateLink endpoints within your VPC, you can't create any more Aurora Serverless clusters in that VPC.如果您达到 VPC 中 PrivateLink 终端节点的限制,则无法在该 VPC 中创建更多 Aurora Serverless 集群。 For information about checking and changing the limits on endpoints within a VPC, see Amazon VPC Limits.有关检查和更改 VPC 内终端节点限制的信息,请参阅 Amazon VPC 限制。

  • You can't access an Aurora Serverless DB cluster's endpoint through an AWS VPN connection or an inter-region VPC peering connection.您无法通过 AWS VPN 连接或区域间 VPC 对等连接访问 Aurora Serverless 数据库集群的终端节点。

aurora-serverless 极光无服务器

You can explore getting-started-with-the-amazon-aurora-serverless-data-api for configuration lambda with Serverless DB.您可以探索 Getting -started-with-amazon-aurora-serverless-data-api以使用无服务器数据库配置 lambda。

Hi I'm also quite new on AWS.嗨,我对 AWS 也很陌生。 I have a lambda function using sqlalchemy and alembic to connect to a postgre database.我有一个 lambda function 使用 sqlalchemy 和 alembic 连接到 postgre 数据库。 Locally I connect to the db using these params in a.env file: RS_POSTGRES_USER在本地,我使用 a.env 文件中的这些参数连接到数据库:RS_POSTGRES_USER
RS_POSTGRES_PASSWORD RS_POSTGRES_PASSWORD
RS_POSTGRES_PORT RS_POSTGRES_PORT
RS_POSTGRES_HOST RS_POSTGRES_HOST
RS_POSTGRES_DB RS_POSTGRES_DB

I have created an Aurora serverless RDS, but not using dataAPI.我创建了一个 Aurora 无服务器 RDS,但没有使用 dataAPI。 Both RDS and lambda are deployed in the same VPC (same subnets and security group). RDS 和 lambda 都部署在同一个 VPC(同一个子网和安全组)中。 Any other things to do (VPC, IAM role), to make sure my lambda can connect to my DB?还有其他事情要做(VPC、IAM 角色),以确保我的 lambda 可以连接到我的数据库? For now I have a timeout error.现在我有一个超时错误。

Thanks.谢谢。

Edouard爱德华

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

相关问题 AWS Aurora 无服务器 mysql、Cognito、Lambda、API 网关、CloudFormation 启动器 - AWS Aurora serverless mysql, Cognito, Lambda, API gateway, CloudFormation starter Aws 极光 + Lambda - Aws Aurora + Lambda AWS - 使用 NAT 网关(由 Lambda 访问)的私有子网中的 EC2 代理到无服务器 Aurora 的 Internet 访问 - AWS - Internet Access for an EC2 Proxy to Serverless Aurora in a Private Subnet with NAT Gateway (Accessed by Lambda) 具有 API 网关和 Lambda 的 Aurora Serverless 超时 - Aurora Serverless with API Gateway and Lambda is timing out 使用 Spring Boot 连接到 AWS Aurora Serverless - Connecting to AWS Aurora Serverless with Spring Boot 是否可以生成无服务器的AWS Aurora MySql图表 - Is it possible to generate a diagram of AWS Aurora MySql serverless 将大文件上传到 AWS aurora postgres serverless - uploading large file to AWS aurora postgres serverless 什么是 AWS Aurora Serverless 纵向扩展时间? - What is AWS Aurora Serverless scale up time? 在 Aurora AWS Serverless MySQL 上启用 SSL - Enable SSL on Aurora AWS Serverless MySQL AWS Aurora 无服务器 - 通信链路故障 - AWS Aurora Serverless - Communication Link Failure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM