如何解决将 CloudFormation 参数作为字符串列表传递
我正在尝试通过参数将 Lambda 策略列表传递到我的 CloudFormation 脚本中,我发现了一些关于如何执行此操作的 examples,但是当我尝试拆分我的 LambdaPolicies 参数时,它给出了 ManagedPolicyArns 属性的值必须是 List of String 类型。
AWstemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description:
An AWS Lambda application that calls the Lambda API.
Parameters:
- LambdaName
- LambdaVersion
- LambdaCodeUriKey
- LambdaCodeUriBucket
- LambdaHandler
- LambdaRuntime
- LambdaTimeout
- Lambdamemory
- LambdaDescription
- LambdaPolicies
- LambdaTracing
Parameters:
LambdaName:
Description: The name of the Lambda function,this will be viewable within the AWS Management Console
Type: String
AllowedPattern: ^[-_A-Za-z-0-9][-_A-Za-z0-9 ]{1,126}[-_A-Za-z-0-9]$
ConstraintDescription: The parameter must only contain Uppercase and lowercase letters and numbers
LambdaVersion:
Description: The version number for the component
Type: String
AllowedPattern: ^[0-9]+\.[0-9]+\.[0-9]+$
ConstraintDescription: The parameter must match the following pattern for version. 10.2.3
LambdaCodeUriKey:
Description: The path to the Lambda code within the S3 bucket
Type: String
LambdaCodeUriBucket:
Description: The name of the S3 bucket containing the Lambda code
Type: String
Default: 'default-s3-bucket'
LambdaHandler:
Description: The name for the Lambda handler which triggers the function
Type: String
Default: 'Handler::Handler.Bootstrap::ExecuteFunction'
LambdaRuntime:
Description: The name for the Lambda runtime
Type: String
Default: 'dotnetcore3.1'
LambdaTimeout:
Description: The timeout to be assigned to the Lambda function in seconds
Type: Number
Default: 30
Lambdamemory:
Description: The memory to be assigned to the Lambda function in MB
Type: Number
Default: 512
LambdaPolicies:
Description: A comma delimited list of Lambda policies to be assigned to the function
Type: String
Default: "AWSLambdaBasicExecutionRole,AWSLambda_ReadOnlyAccess,AWSXraywriteonlyAccess"
Resources:
function:
Type: AWS::Serverless::Function
Properties:
Handler: Handler::Handler.Bootstrap::ExecuteFunction
Runtime: dotnetcore3.1
CodeUri:
Bucket: !Ref LambdaCodeUriBucket
Key: !Ref LambdaCodeUriKey
Description: Call the AWS Lambda API
Timeout: 30
MemorySize: 512
# Function's execution role
Policies: !Split [',',!Ref LambdaPolicies]
Tracing: Active
以下是我尝试通过参数创建的示例
Policies:
- AWSLambdaBasicExecutionRole
- AWSLambda_ReadOnlyAccess
- AWSXraywriteonlyAccess
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。