AWS EC2 有 dsl 吗?
我正在考虑使用 Amazon 云服务(EC2、S3 等)进行托管。我一直在研究可指定用于配置各种实例的 JSON 元数据,其复杂性令我担忧。是否有一个 dsl 可以生成有效的 JSON 元数据,更重要的是验证条目?
I am looking at using Amazon cloud services (EC2, S3 etc) for hosting. I've been looking at the JSON metadata that can be specified to configure various instances and the complexity has me concerned. Is there a dsl that will generate valid JSON metadata and more importantly validate the entries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不幸的是,我最近搜索后一片空白。我正在使用 Amazon Web Services CloudFormation(这是您所说的 JSON 元数据吗?)。
CloudFormation JSON 文件存在几个问题:
因此,我一直在 Scala 中使用 Java API 进行直接 API 调用。实际上真的很好。
Java API 具有以
with
开头的“setter”风格,返回this
,以便将它们链接起来。在 Scala 中,您可以使用它们来充当穷人的 DSL。因此,您可以使用 Java API 在 Scala 中做其他事情很容易做之类的事情。例如,在地图中按 VPC 将所有子网分组,只需执行以下操作
Unfortunately, I drew a blank after searching for this recently. I'm using Amazon Web Services CloudFormation (is that the JSON metadata you're talking about?).
There are a couple of issues with CloudFormation JSON files:
So I've been using straight-up API calls in Scala using the Java API. It's actually really nice.
The Java API has a flavor of "setters" starting with
with
that returnthis
so they can be chained. In Scala, you can use these to act like a poor-man's DSL. So you can do things likeOther things are easy to do in Scala with the Java API. For example, group all your Subnets by VPC in a Map, simply do
如果有人仍在寻找 AWS CloudFormation DSL - 我们一直在使用用于 CloudFormation 的 Ruby DSL< /a>:
https://github.com/bazaarvoice/cloudformation-ruby-dsl
CloudFormation 请求模板正文 大小限制很烦人 - 我们必须将大型 CloudFormation 模板上传到 S3,然后使用其 S3 URL 创建/更新堆栈。
In case anyone is still looking for the AWS CloudFormation DSL - we've been using the Ruby DSL for CloudFormation:
https://github.com/bazaarvoice/cloudformation-ruby-dsl
The CloudFormation request template body size limits are annoying - we have to upload our large CloudFormation templates to S3, then create/update stacks using their S3 URLs.
现在,虽然我还没有使用它:Coffin a CoffeeScript DSL for CloudFormation。
如果您不是在谈论 CloudFormation,而是在谈论更通用的 API,那么我发现的最好的界面是 AWS 自己的 aws-sdk ruby gem。与他们发布的其他 SDK 不同,这些 SDK 的 make-client/make-request/get-response/look-at-result 事务做得很好,但很粗糙,Ruby SDK 在顶部封装了一个更好的域模型,因此您可以通过更高抽象级别的集合进行交互。
它还具有相当好的性能功能,如果您知道不需要新的响应,您可以缓存响应以节省往返时间。
There is now, though I haven't used it yet: Coffin a CoffeeScript DSL for CloudFormation.
If you're not talking about CloudFormation, but instead more general API talking, then the nicest interface I've found is AWS' own aws-sdk ruby gem. Unlike the other SDKs that they publish which are quite nicely-done-but-crude make-client/make-request/get-response/look-at-result affairs, the ruby SDK wraps a nicer domain-model over the top, so you interact via collections at a higher abstract level.
It also has quite-nice performance features in that you can cache responses to save on round-trips, if you know you don't need fresh responses.
我的 CloudFormation 模板超过 3000 行。我发现在 JSON 中添加注释非常有帮助!您只需在使用前将其剥离即可。有一个验证器可以验证模板并删除注释: http://cloudformation-validation.com/
I have CloudFormation templates upwards of 3000 lines. I have found that putting comments in the JSON helps tremendously!! You just have to strip it out before using it. There is a validator that would validate the template and strip out the comments: http://cloudformation-validation.com/
不,截至 2022 年 2 月,AWS 仍然没有为基础设施即代码提供任何特定于领域的语言。它们与 Azure 的 Bicep 或 Terraform 的 HCL。
这确实让我感到惊讶,因为我通常认为 AWS 比其他主要竞争对手(Azure 和 GCP)更昂贵,但处于领先地位。
但是,Cloud Formation 现在支持 JSON 和 YAML 格式。略有改善??恕我直言,当您拥有代表整个云堆栈的整个存储库时,情况并非如此。如果您使用 AWS,请使用 Terraform 来管理 IaC。
No, as of Feb 2022, AWS still does not provide any domain-specific language for infrastructure as code. They have nothing similar to Azure's Bicep or Terraform's HCL.
This really surprises me, as I generally think of AWS as being more expensive, but ahead of the curve, compared to other major competitors (Azure and GCP).
However, Cloud Formation now allows both JSON and YAML formats. Slight improvement?? IMHO, not really when you have an entire repo that represents your entire cloud stack. If you're using AWS, use Terraform to manage IaC.