amazon-web-services - 将 CloudFormation 参数作为字符串列表传递
问题描述
我正在尝试通过参数将 Lambda 策略列表传递到我的 CloudFormation 脚本中,我找到了一些如何执行此操作的示例,但是当我尝试拆分我的 LambdaPolicies 参数时,它给出了属性 ManagedPolicyArns 的值必须是类型的错误字符串列表。
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
解决方案
推荐阅读
- spring - Spring Redis Data 给出 UncategorizedKeyValueException: nested exception is java.lang.NullPointerException
- laravel-5 - 添加额外参数后找不到控制器方法
- sql - Spark SQL 中的 Listagg 替代方案
- git - GIT - 停止跟踪文件而不将其从服务器中删除
- json - 禁止 Json 输出中的空对象列表
- python - 转换亚马逊AWS坐标
- javascript - jQuery窗口调整大小并小于一定宽度
- wordpress - 有没有办法知道其他人是否正在编辑相同的functions.php或style.css,Wordpress?
- python - python列表的区别
- scala - 在Scala中将数组转换为具有列和索引的数据框