AWS Athena 部署无服务器框架
AWS Athena deployment serverless framework
有人提示我必须如何将 !Ref und !Sub 从 CloudFormation 转换为 serverless.yml。
resources:
Resources:
AthenaCreateDatabaseQuery:
Type: 'AWS::Athena::NamedQuery'
Properties:
Description: Run this query to initialize the Athena database
QueryString: "CREATE DATABASE IF NOT EXISTS $(self:custom.etlDatabase};"
Database: ${self:custom.etlDataBase}
- 在 Cloudformation 中,QueryString 属性 以 !Sub 开头,
带有 !Ref.
的数据库 属性
谢谢克里斯蒂安
!serverless.com 目前不支持 Sub(see this issue on GitHub) but you can use the following plugin https://gitlab.com/kabo/serverless-cf-vars
Whenever you want the cloudformation template to have a string that contains ${}, simply use #{} instead, and it will get transformed into correct ${} (with Fn::Sub inserted for you) in the cloudformation template before deployment.
或者按照建议使用自定义变量语法 here。两者都需要在 yaml 中使用 Fn::Sub 和 Fn::Ref 而不是短格式 !Sub 和 !Ref
有人提示我必须如何将 !Ref und !Sub 从 CloudFormation 转换为 serverless.yml。
resources:
Resources:
AthenaCreateDatabaseQuery:
Type: 'AWS::Athena::NamedQuery'
Properties:
Description: Run this query to initialize the Athena database
QueryString: "CREATE DATABASE IF NOT EXISTS $(self:custom.etlDatabase};"
Database: ${self:custom.etlDataBase}
- 在 Cloudformation 中,QueryString 属性 以 !Sub 开头, 带有 !Ref. 的数据库 属性
谢谢克里斯蒂安
!serverless.com 目前不支持 Sub(see this issue on GitHub) but you can use the following plugin https://gitlab.com/kabo/serverless-cf-vars
Whenever you want the cloudformation template to have a string that contains ${}, simply use #{} instead, and it will get transformed into correct ${} (with Fn::Sub inserted for you) in the cloudformation template before deployment.
或者按照建议使用自定义变量语法 here。两者都需要在 yaml 中使用 Fn::Sub 和 Fn::Ref 而不是短格式 !Sub 和 !Ref