【问题标题】:How to include a swagger file path externally in cloud formation yaml aws如何在云形成yaml aws中外部包含一个招摇的文件路径
【发布时间】:2020-08-06 19:19:05
【问题描述】:

我们如何包含本地机器路径而不是 S3 存储桶路径以在云形成 yaml 中包含 swagger 文件的 url。

我包含本地swagger文件路径的yaml文件是-

但是,在 aws 文档和我搜索过的所有地方,我都知道我们需要在 s3 存储桶中上传 swagger,然后给出类似的路径 -

Fn::Transform:
  Name: AWS::Include
  Parameters:
    Location: s3://MyAmazonS3BucketName/MyFileName.yaml

参考 - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html

我意识到一旦在 aws 服务器上,aws 将无法找到我们的机器文件。 有没有办法通过 cli 命令同时包含或上传 swagger 文件,而不是将 swagger 正文包含在您的 cloudFormation.yaml 文件中。

我的 cli 命令是 -

aws cloudformation create-stack --stack-name justatemplate --template-body file://E:/Documents/swagger.yaml  --no-verify-ssl  --capabilities CAPABILITY_NAMED_IAM

【问题讨论】:

  • 这是不可能的,但是您先将文件上传到 S3,然后在模板中使用它,如果您需要帮助,请告诉我
  • 哦好的............

标签: amazon-web-services amazon-s3 swagger amazon-cloudformation


【解决方案1】:

如果您使用的是 SAM,只需参考本地文件路径即可。查看代码here

【讨论】:

    猜你喜欢
    • 2019-05-21
    • 2017-12-19
    • 1970-01-01
    • 2015-08-15
    • 1970-01-01
    • 2021-07-08
    • 1970-01-01
    • 2020-07-22
    • 2021-01-05
    相关资源
    最近更新 更多