gpt4 book ai didi

amazon-web-services - 何时使用 Cloud Formation 以及何时使用 EC2 实例

转载 作者:行者123 更新时间:2023-12-03 07:48:23 25 4
gpt4 key购买 nike

今天是设置云环境的第一天,我需要在这里澄清一下。我很困惑是否需要使用 AWS 云形成或 EC2 Ubuntu 实例来设置 posthog。作为先决条件,我还需要安装 Python、Yarn、PostgreSQL 和 Redis。我们一开始会有少量流量。

预先感谢您的任何意见。

最佳答案

来自What is AWS CloudFormation? :

AWS CloudFormation is a service that helps you model and set up your AWS resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS. You create a template that describes all the AWS resources that you want (like Amazon EC2 instances or Amazon RDS DB instances), and CloudFormation takes care of provisioning and configuring those resources for you. You don't need to individually create and configure AWS resources and figure out what's dependent on what; CloudFormation handles that.

例如,您可以使用 CloudFormation 部署 Amazon EC2 实例,选择其实例类型、网络属性和磁盘卷。您还可以提供一个在实例首次启动时运行的脚本,该脚本可能会在实例上加载和配置软件。

CloudFormation 是以可重复方式部署此类基础设施的好方法。例如,您可以部署与生产完全匹配的暂存环境。它支持基础设施部署的“千篇一律”方法,并强制基础设施“记录为代码”。

您描述的软件包(Python、Yarn 等)无法由 CloudFormation 进行配置,除非您提供在实例首次启动时运行的脚本,并且该脚本执行所有安装。您需要编写该脚本。可能需要进行多次尝试才能使脚本正确,但如果您想将来再次部署类似的基础设施,这是值得的。

但是,如果您的目的是仅创建一个这样的环境并且您无需准确记录如何重建环境,那么您可以随意启动 Amazon EC2 实例并手动安装任何软件您想要的,无需使用 CloudFormation。然后,您可以通过创建 Amazon Machine Image (AMI) 来备份您的设置,这是磁盘的备份,以便将来可以启动实例的“克隆”。

关于amazon-web-services - 何时使用 Cloud Formation 以及何时使用 EC2 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68514553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com