簡體   English   中英

aws 無服務器多個 yaml java

[英]aws serverless multiple yaml java

我得到了 AWS 示例無服務器應用程序,其中有單個 yaml 文件和多個處理程序。

問題是 template.yaml 一直在增長,如何為每個處理程序或一組處理程序分離 yaml 以便於管理。

對於我們的項目,我們開始以下一種方式將主 YAML 划分為多個:

  • 所有 lambdas 仍然在 serverless.yml 文件中描述

  • 在 serverless.yml 中

    resources: - ${file(./sls-config/cognito-user-pools-authorizer.yml)} - ${file(./sls-config/aurora.yml)} - ${file(./sls-config/bucket.yml)} - ${file(./sls-config/queues.yml)} - ${file(./sls-config/alarms.yml)} - ${file(./sls-config/roles.yml)} - ${file(./sls-config/outputs.yml)}

是的,由你來分配資源。

  • 警報.yml

     Resources: SQSAlarmTopic: Type: AWS::SNS::Topic Properties: DisplayName: ${self:provider.prefix}-sqs-alarm-topic TopicName: ${self:provider.prefix}-sqs-alarm-topic Subscription: - Endpoint: example-email@mail.com Protocol: email Tags: ${self:custom.sqsTags}

    等等。

  • 輸出.yml

     Outputs: CognitoUserPoolId: Value: ${self:custom.userPool} CognitoUserPoolClientId: Value: ${self:custom.userPoolClientId} DSClusterID: Description: "RDS Cluster " Value: { Ref: RDSCluster } DBAddress: Value: !GetAtt RDSCluster.Endpoint.Address

custom 和 provide 中的變量可以通過 sub_configs.yml 輕松使用。

小心 yaml 文件中的間距/填充:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM