An engineer is deploying a serverless application using a template that defines a Lambda function triggered by an Amazon S3 event. The function needs to execute with a custom IAM role. During the deployment, the stack fails to create the resources successfully. The relevant section of the template is structured as follows:
yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
ProcessFileFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs20.x
Role: !GetAtt ProcessingRole.Arn
ProcessingRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: Service: s3.amazonaws.com
Action: sts:AssumeRole
Which of the following modifications will resolve the deployment failure and allow the Lambda function to assume the role?
- Update the Service principal under the AssumeRolePolicyDocument of the ProcessingRole to lambda.amazonaws.com.Cevap
- BAdd a Transform: AWS::Serverless-2016-10-31 declaration inside the Properties section of the ProcessingRole.
- CChange the event source integration format to Lambda Proxy (AWS_PROXY) within the S3 bucket configuration.
- DIncrease the Timeout property of the AWS::Serverless::Function resource to allow S3 more time to assume the execution role.