在发布此问题之前,我已经参考了这个问题.
检查Null Wrappers是否符合原始值
我有我要检查情况Wrapper Integer
与null
以及0
if( statusId != null || statusId != 0 ) //statusId is Integer it maybe 0 or null
// Do Somethimg here
Run Code Online (Sandbox Code Playgroud)
我怎样才能克服这种情况?
我正在使用 cloudformation 模板创建两个资源 AWS Lambda 函数和角色。
我使用角色 arn 作为环境变量。稍后在 S3 连接的代码中使用它。但出现异常
com.amazonaws.services.securitytoken.model.AWSSecurityTokenServiceException:
User: arn:aws:sts::{account_id}:assumed-role/* is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::{account_id}:role/*
Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: ; Proxy: null)
Run Code Online (Sandbox Code Playgroud)
如何在信任关系和内联策略中添加相同的角色 arn?
如何克服上述异常?
其他解决方案表示赞赏
CF 模板片段
com.amazonaws.services.securitytoken.model.AWSSecurityTokenServiceException:
User: arn:aws:sts::{account_id}:assumed-role/* is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::{account_id}:role/*
Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: ; Proxy: null)
Run Code Online (Sandbox Code Playgroud)
AWS S3 连接代码片段
Resources:
LambdaFunctionExecutionRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- …
Run Code Online (Sandbox Code Playgroud) java amazon-s3 amazon-web-services aws-cloudformation aws-lambda