An AWS Lambda function is configured to upload generated reports to an Amazon S3 bucket. During execution, the Lambda function fails to write to the bucket and returns an 'Access Denied' error. How should the developer resolve this authorization failure?
- Attach an IAM policy to the Lambda execution role that grants the s3:PutObject action on the target S3 bucket ARN.Cevap
- BModify the Lambda execution role's trust policy to include s3:PutObject in the Action block.
- CInitialize the S3 SDK client inside the Lambda function using hardcoded Administrator access keys.
- DCreate an Amazon Cognito User Pool and configure it to generate temporary AWS credentials for the Lambda function.
Cevap
Attach an IAM policy to the Lambda execution role that grants the s3:PutObject action on the target S3 bucket ARN.
The correct option addresses the authorization failure by adding a policy to the Lambda execution role. In AWS, Lambda functions use an execution role to acquire temporary security credentials. Granting the 's3:PutObject' permission on the specific bucket ARN in this execution role permits the Lambda function to upload reports successfully.
Adım Adım Çözüm
Anahtar Kavram
Resolving AWS permission failures by attaching identity-based IAM policies to execution roles.
Tahmini Süre:1m 0s