amazon-web-services - 如何在云形成 yaml aws 中外部包含 swagger 文件路径

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

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

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

enter image description here

但是,在 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

最佳答案

如果您使用 SAM,只需引用本地文件路径即可实现这一点。查看代码here .

关于amazon-web-services - 如何在云形成 yaml aws 中外部包含 swagger 文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61387674/

相关文章:

java - AWS XRay SDK 无法读取 Docker 容器内的环境变量

python - 将字典列表作为 csv 直接写入 S3

asp.net-core - 在反向代理后面运行时,使用端口 80 进行 https 的 Swashbuckle

amazon-web-services - 从 S3 下载工件时代码构建访问被拒绝

amazon-web-services - 安塞 bool : Execute commands on newly created EC2 instance

javascript - 在node js中调整图像大小

swagger - Swagger 2.0 中没有类型属性的架构对象

spring-boot - Spring Boot 执行器/Swagger

c# - Alexa TopSites - 连续签名失败 - C# 实现

elasticsearch - 无法将多行事件从Filebeat S3输入推送到Logstash