"Fn::Join" 在配置文件中指的是什么?
What does "Fn::Join" refers to in a config file?
我是无服务器新手,但请看一下这个配置文件
provider:
name: aws
runtime: nodejs10.x
stage: dev
region: us-east-1
# you can add statements to the Lambda function's IAM Role here
# iamRoleStatements:
# - Effect: "Allow"
# Action:
# - "s3:ListBucket"
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
# - Effect: "Allow"
# Action:
# - "s3:PutObject"
# Resource:
# Fn::Join:
# - ""
# - - "arn:aws:s3:::"
# - "Ref" : "ServerlessDeploymentBucket"
# - "/*"
此资源是否引用 fnproject?
我查看了 aws-resource-type 但找不到参考信息。
Fn::Join
是 CloudFormation 中用于连接字符串的函数。 Ref
是另一个引用在 CloudFormation 中创建的元素的函数。
在您的示例中,Fn::Join
用于连接字符串以创建 S3 存储桶的 ARN,其格式为 arn:aws: s3:::bucketname 需要在 Lambda 中授予存储桶权限。
Fn::Join
是一个内部函数,它将一组值附加到单个值中,由指定的分隔符分隔。如果定界符是空字符串,则值集连接时没有定界符。
您也可以在 join 和 pseudo parameters 中使用不同的内部函数。
有关详细信息,请查看 official AWS documentation
我是无服务器新手,但请看一下这个配置文件
provider:
name: aws
runtime: nodejs10.x
stage: dev
region: us-east-1
# you can add statements to the Lambda function's IAM Role here
# iamRoleStatements:
# - Effect: "Allow"
# Action:
# - "s3:ListBucket"
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
# - Effect: "Allow"
# Action:
# - "s3:PutObject"
# Resource:
# Fn::Join:
# - ""
# - - "arn:aws:s3:::"
# - "Ref" : "ServerlessDeploymentBucket"
# - "/*"
此资源是否引用 fnproject?
我查看了 aws-resource-type 但找不到参考信息。
Fn::Join
是 CloudFormation 中用于连接字符串的函数。 Ref
是另一个引用在 CloudFormation 中创建的元素的函数。
在您的示例中,Fn::Join
用于连接字符串以创建 S3 存储桶的 ARN,其格式为 arn:aws: s3:::bucketname 需要在 Lambda 中授予存储桶权限。
Fn::Join
是一个内部函数,它将一组值附加到单个值中,由指定的分隔符分隔。如果定界符是空字符串,则值集连接时没有定界符。
您也可以在 join 和 pseudo parameters 中使用不同的内部函数。 有关详细信息,请查看 official AWS documentation