无法 link AWS S3 与 AWS Lambda
Unable to link AWS S3 with AWS Lambda
我想连接我的 AWS S3 with my AWS Lambda。我创建了我的 s3 存储桶并将其命名为 xyz
。在我的 AWS Lambda 函数上创建事件源时,它显示以下错误
There was an error creating the event source mapping: Your bucket must be in the same region as the function.
在执行此 link 时,我发现我需要为 AWS Lambda 函数的 s3 存储桶设置事件通知。但是我无法为 s3 存储桶设置事件通知,因为它没有在 s3 存储桶属性的事件选项卡中显示 AWS lambda 函数的设置。
我为Lambda创建的IAM角色的策略文档如下
{
"Version": "VersionNumber",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::xyz/*"
]
}
]
}
有人可以告诉我为什么我无法为 AWS Lambda 创建事件来对 s3 存储桶进行操作吗?
感谢 John 的评论,我得以解决此问题。
当(错误消息明确指出)Lambda 和 S3 存储桶位于不同区域时,会出现此问题。
要在与 s3 存储桶相同的区域创建 lambda,您需要知道存储桶的区域。
To view the region of an Amazon S3 bucket, click on the bucket in the management console, then go to the Properties tab. The region will be displayed
现在您知道了您的目标区域。您可以在 aws 控制台中切换到该区域,方法是从 Support
菜单前右上角的下拉选择菜单中选择一个区域。
将区域更改为 s3 存储桶的区域后,创建新的 lambda 函数将解决问题。
我想连接我的 AWS S3 with my AWS Lambda。我创建了我的 s3 存储桶并将其命名为 xyz
。在我的 AWS Lambda 函数上创建事件源时,它显示以下错误
There was an error creating the event source mapping: Your bucket must be in the same region as the function.
在执行此 link 时,我发现我需要为 AWS Lambda 函数的 s3 存储桶设置事件通知。但是我无法为 s3 存储桶设置事件通知,因为它没有在 s3 存储桶属性的事件选项卡中显示 AWS lambda 函数的设置。
我为Lambda创建的IAM角色的策略文档如下
{
"Version": "VersionNumber",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::xyz/*"
]
}
]
}
有人可以告诉我为什么我无法为 AWS Lambda 创建事件来对 s3 存储桶进行操作吗?
感谢 John 的评论,我得以解决此问题。
当(错误消息明确指出)Lambda 和 S3 存储桶位于不同区域时,会出现此问题。
要在与 s3 存储桶相同的区域创建 lambda,您需要知道存储桶的区域。
To view the region of an Amazon S3 bucket, click on the bucket in the management console, then go to the Properties tab. The region will be displayed
现在您知道了您的目标区域。您可以在 aws 控制台中切换到该区域,方法是从 Support
菜单前右上角的下拉选择菜单中选择一个区域。
将区域更改为 s3 存储桶的区域后,创建新的 lambda 函数将解决问题。