我尝试了this answer中的解决方案,但对我而言不起作用。我收到错误消息:
提供的执行角色无权在EC2上调用CreateNetworkinterface (服务:AWSLambdaInternal;状态代码:400;错误代码:InvalidParameterValueException;请求ID:4c8d047c-2710-4334-86cd-51b7467c6f08 )
以下是与错误关联的CloudFormation:
EventLambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Sub ${DeveloperPrefix}event-lambda-${Environment}-${DeployPhase}
Handler: EventHandler
Runtime: java8
Code:
S3Bucket: !Ref SharedBucketName
S3Key: !Sub ${WorkspacePrefix}/event-subscriber-${AppVersion}.jar
S3ObjectVersion: !Ref EventLambdaS3Version
Role: !Getatt EventLambdaRole.Arn
Environment:
Variables:
retry_event_table_name: !Sub "${DeveloperPrefix}${AppName}-${RetryEventTableName}-${Environment}-${DeployPhase}"
test_enabled: true # TODO: Remove once endpoint provided.
VpcConfig:
SecurityGroupIds:
- !Ref LambdaSecurityGroup
SubnetIds:
- Fn::Importvalue: !Sub ${VPCStackName}-SubnetPrivateL
- Fn::Importvalue: !Sub ${VPCStackName}-SubnetPrivateR
Timeout: 28
MemorySize: 256
EventLambdaRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub ${DeveloperPrefix}${AppName}-${Environment}-${DeployPhase}-EventLambdaRole
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: [lambda.amazonaws.com]
action: ['sts:AssumeRole']
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Policies:
- PolicyName: !Sub ${DeveloperPrefix}${AppName}-${Environment}-${DeployPhase}-EventLambdaPolicy
PolicyDocument:
Statement:
- Sid: DynamoDbPermissions
Effect: Allow
action:
- dynamodb:PutItem
Resource: !Sub 'arn:aws:dynamodb:${AWS::Region}:${AWS::accountId}:table/${DeveloperPrefix}${AppName}-EventRetry-${Environment}-${DeployPhase}'
- Sid: LambdaVPCPermissions
Effect: Allow
action:
- ec2:AttachNetworkinterface
- ec2:CreateNetworkinterface
- ec2:CreateNetworkinterfacePermission
- ec2:DeleteNetworkinterface
- ec2:DeleteNetworkinterfacePermission
- ec2:DescribeDhcpoptions
- ec2:DescribeNetworkinterfaces
- ec2:DescribeNetworkinterfacePermissions
- ec2:DescribeSubnets
- ec2:DescribeVpcs
- ec2:DescribeInstances
Resource: '*'
我一直在寻找答案,并尝试了一些发现的建议,但无济于事。我犯了任何明显的错误?我担心我现在看不到森林覆盖树木。