我米使用AWS LAMBDA上傳文件到S3並且使用命令S3政策問題時
s3 = boto3.resource('s3')
s3.meta.client.upload_file("/tmp/" + fileName, [BUCKET NAME], fileName)
而且也LAMBDA政策定義爲
{
"Action": [
"s3:PutObject"
],
"Resource": "arn:aws:s3:::[BUCKET NAME]",
"Effect": "Allow"
},
但是當我運行它發出的功能錯誤
(<class 'boto3.exceptions.S3UploadFailedError'>,
S3UploadFailedError('Failed to upload /tmp/[FILE NAME] to [BUCKET
NAME]/[FILE NAME]: An error occurred (AccessDenied) when calling the
PutObject operation: Access Denied',), <traceback object at
0x7f61e9d2ec48>)