背景:
IAM策略可以通过两种方式创建:
管理政策(新路)
- AWS管理政策
- 客户管理策略
内嵌政策(旧的方式)
下面SAM模版是创建内嵌政策:
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello-world/
Handler: app.LambdaHandler
Runtime: nodejs8.10
Policies:
- Statement:
- Sid: AccessToS3Policy
Effect: Allow
Action:
- s3:GetObject
- s3:GetObjectACL
Resource: 'arn:aws:s3:::some-bucket/*'
在所得到的作用,如下图所示:
{
"roleName": "somestack-HelloWorldFunctionRole-AAAAAAAA",
"policies": [
{
"document": {
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:GetObjectACL"
],
"Resource": "arn:aws:s3:::some-bucket/*",
"Effect": "Allow",
"Sid": "AccessToS3Policy"
}
]
},
"name": "HelloWorldFunctionRolePolicy0",
"type": "inline"
},
.....
]
}
在lambda表达式的情况下,
1)如何建立客户管理的策略?
2)如何直列政策不同客户管理的策略?