aws ec2_ec2 aws的心

aws ec2

Amazon web services have so many services to offer it often feels like finding a needle in a haystack.

亚马逊网络服务提供了如此多的服务,感觉就像在大海捞针。

EC2 is one of the most popular offerings of AWS.

EC2是AWS最受欢迎的产品之一。

Elastic Cloud Compute is the scalable compute capacity provided by AWS. It is your hardware on the cloud which is on-demand and ready to be provisioned with a lot of options to choose from. Imagine having the power to provide an unlimited fleet of Instance with a lot of computing capacity and no upfront payment.

弹性云计算是AWS提供的可扩展计算能力。 随需应变的是您在云上的硬件,随时可以为其提供许多选择。 想象一下,有能力提供具有大量计算能力且无需预付款的无限实例实例。

EC2 mainly consists of capabilities such as Renting virtual machines, storing data on virtual devices using EBS, distributing the load across machines using ELB, and scaling services using the auto-scaling groups.

EC2主要包括以下功能:租用虚拟机,使用EBS在虚拟设备上存储数据,使用ELB在计算机之间分配负载以及使用自动扩展组扩展服务。

Renting virtual machines:

租用虚拟机:

Virtual machines are the heart of cloud computing if you ignore serverless for a moment. Nearly every application running on the cloud uses a virtual machine as their host.

如果您暂时忽略无服务器,虚拟机将是云计算的核心。 几乎所有在云上运行的应用程序都使用虚拟机作为其主机。

AWS provides a variety of virtual machines to rent with different sizes and memory or compute capacity or based on the payment options as well. The instances sizes vary from t2.nano being the smallest to i3en.metal with various combinations of memory-optimized, compute-optimized, storage-optimized, and General purpose.

AWS提供了各种虚拟机,它们可以租用具有不同大小和内存或计算能力的虚拟机,也可以基于付款方式租用。 实例的大小从最小的t2.nano到i3en.metal,具有内存优化,计算优化,存储优化和通用的各种组合。

It has so many options that one can easily get confused while choosing the right instance for their type of workload. But having so many options to choose from and having categorized instances based on the type of workload they can optimally handle can also provide some help while choosing the instance type.

它有很多选择,以至于在为他们的工作负载类型选择合适的实例时,很容易感到困惑。 但是,有太多选项可供选择,并且根据实例可以优化处理的工作负载类型对其进行了分类,这也可以在选择实例类型时提供一些帮助。

Pricing of virtual machines also varies from no upfront payment to reserved instances which also provides options to its customer on whether they want to a commitment or not. The pay as you go model can help some to save money if you have no idea about the workload you are going to have. While reserving instances or Host for a period of time can also save some money for customers who know their workload and can commit for a period of time to have stability. There are many more options such as spot instances that are super cheap but can be taken away if the bid goes higher.

虚拟机的定价也从无预付款到预留实例不等,这也为其客户提供了是否要承诺的选项。 如果您不知道要承担的工作量,那么按需付款模型可以帮助一些人省钱。 在保留实例或主机一段时间后,还可以为知道其工作量并可以承诺一定时间保持稳定性的客户节省一些钱。 还有很多其他选择,例如现货实例,它们非常便宜,但是如果出价提高,可以将其取消。

存储数据: (Storing data:)

Elastic Block Storage is a network drive for AWS, It acts as a raw disk for storage in EC2. It is like a detachable drive on the cloud. You can use EBS volumes and attach them to any instance and start using them instantly. In the case of instance failure, the data stored in EBS is secured and can be detached from the instance and used somewhere else.

Elastic Block Storage是AWS的网络驱动器,它充当EC2中存储的原始磁盘。 就像云上的可拆卸驱动器。 您可以使用EBS卷并将它们附加到任何实例,然后立即开始使用它们。 在实例失败的情况下,存储在EBS中的数据是安全的,可以与实例分离并在其他地方使用。

As EBS acts as an independent entity it can be detached from one instance and can be attached to another. EBS volumes are locked to an Availability zone and have a provisioned capacity. EBS volumes come in 4 types i.e.

由于EBS充当独立实体,因此它可以与一个实例分离并可以附加到另一个实例。 EBS卷被锁定到“可用性”区域并具有预配置的容量。 EBS卷有4种类型,即

Elastic Block Storage
EBS
电子广播系统
  1. GP2 (SSD)

    GP2(固态硬碟)
  2. IO1 (SSD)

    IO1(SSD)
  3. ST1 (HDD)

    ST1(硬盘)
  4. SC1 (HDD)

    SC1(硬碟)

Instance Store also provides temporary block storage for instances. These are different from EBS as they are physically attached to the Host instance, this comes with its pros and cons.

实例存储还为实例提供临时块存储。 这些与EBS有所不同,因为它们物理连接到Host实例,这具有其优缺点。

Instance Store with EC2
Instance Store
实例存储

Pros being:

优点是:

  1. As they are physically attached to the host instance it has better I/O performance.

    由于它们物理连接到主机实例,因此具有更好的I / O性能。
  2. The instance store can be used as a Buffer or a cache.

    实例存储可以用作缓冲区或缓存。
  3. The data stored in the Instance store is persisted during reboots.

    重新启动期间,实例存储中存储的数据将保持不变。

Cons being:

缺点是:

  1. On stop or termination, the instance store is lost along with the data stored in it.

    在停止或终止时,实例存储及其中存储的数据都会丢失。
  2. You cannot resize the instance store.

    您无法调整实例存储的大小。
  3. If you need to back up the data in the instance store we manually need to back it up there is no automated process. In short Instance store is a physical disk with very high ops that cannot be increased in size and has a risk of data loss if hardware fails.

    如果您需要备份实例存储中的数据,我们需要手动备份,因此没有自动过程。 简而言之,实例存储是具有很高操作性能的物理磁盘,无法增加其大小,并且如果硬件出现故障,则存在数据丢失的风险。

EFS (Elastic File Storage)Amazon EFS is a network file system that is managed by AWS. It provides scalable file storage. It is said to be infinitely scalable and has so many advantages over EBS and Instance Store. We can configure multiple instances to have a common file system. It also works in multiple Availability Zones, which makes it easy for instances from different Availability Zones to connect to the file system and work from the same data source.

EFS(弹性文件存储) Amazon EFS是由AWS管理的网络文件系统。 它提供可扩展的文件存储。 据说它具有无限的可扩展性,并且与EBS和实例存储相比具有许多优势。 我们可以将多个实例配置为具有公共文件系统。 它还可以在多个可用区中使用,这使得来自不同可用区的实例很容易连接到文件系统并从同一数据源进行工作。

Elastic File Storage
Elastic File Storage
弹性文件存储

EFS uses the NFS v4.1 protocol. It is a highly available, scalable, and Expensive service i.e 3 times more expensive from GP2 of EBS. We can use security groups to control access to EFS. We can have encryption at rest using the KMS service.

EFS使用NFS v4.1协议。 它是一种高度可用,可扩展且昂贵的服务,即价格是EBS的GP2的三倍。 我们可以使用安全组来控制对EFS的访问。 使用KMS服务,我们可以在静止状态下进行加密。

NOTE: It is only compatible with Linux based AMI and not windows.

注意:它仅与基于Linux的AMI兼容,而与Windows不兼容。

分配负载: (Distributing load:)

EC2 service provides a load balancer for distributing load between multiple instances in AWS. Using a load balancer helps us to manage the incoming request and balance it across a fleet of instances. This helps us ensure that our application’s downtime is minimized as much as possible.

EC2服务提供了一个负载均衡器,用于在AWS中的多个实例之间分配负载。 使用负载平衡器有助于我们管理传入的请求并在一系列实例之间平衡它。 这有助于我们确保尽可能减少应用程序的停机时间。

We can have multiple downstream instances to balance your load while exposing a single point of access or DNS. This helps us manage failure, Load balancer regularly health checks the instances, and if an instance fails it stops sending traffic to those instances and triggers an alarm. It also provides SSL termination.

我们可以有多个下游实例来平衡您的负载,同时公开一个访问点或DNS。 这有助于我们管理故障,负载均衡器定期对实例进行运行状况检查,如果实例失败,它将停止向这些实例发送流量并触发警报。 它还提供SSL终止。

Load Balancer

There are three types of load balancer in AWS i.e.

AWS中有三种类型的负载均衡器,即

  1. Classic load balancer (V1)

    经典负载均衡器(V1)
  2. Application load balancer (V2)

    应用程序负载平衡器(V2)
  3. Network load balancer (V2)

    网络负载平衡器(V2)

We can also set up a load balancer internally. So that we can load balance internally between the instances. for example, we can have a web tier and an application tier, the web tier sends a request to the application tier. We can set up an internal load balancer to balance requests coming from the web tier into the application tier.

我们还可以在内部设置负载均衡器。 这样我们就可以在实例之间进行内部负载平衡。 例如,我们可以有一个Web层和一个应用程序层,该Web层向该应用程序层发送一个请求。 我们可以设置一个内部负载平衡器来平衡从Web层到应用程序层的请求。

Internal Load Balancer

We can also set up stickiness so that the request from one user only goes to a single instance for a period of time to ensure consistency.

我们还可以设置粘性,以便一个用户的请求仅在一段时间内转到单个实例,以确保一致性。

缩放服务: (Scaling Services:)

Selecting the perfect instance for the workload is one of the most difficult tasks for a solutions architect. Even though there is a range of options to choose from, we still can’t predict the correct amount of instances required to balance our workload. AWS’s Auto-scaling does a commendable job in balancing the number of instances.

为工作负载选择理想的实例是解决方案架构师最困难的任务之一。 即使有多种选择,我们仍然无法预测平衡工作量所需的正确实例数量。 AWS的自动扩展在平衡实例数量方面做得可圈可点。

Just imagine your server having more workload on Wednesdays and less on Sundays, how will you commission servers to match the workload? No worries, we just need to add our instances into an Auto-Scaling group and define policies on how you want to scale your instances. If you have a predictive workload you can set up a policy saying that increases the number of instances to 5 on Wednesdays or if you have an unpredictable workload you can set up policies based on various parameters such as CPU or memory usage. Say if my instances have more than 80% of CPU utilization increase the number of instances by one.

试想一下,您的服务器在星期三有更多的工作量,而在星期天有更少的工作量,您将如何调试服务器以匹配工作量? 不用担心,我们只需要将实例添加到Auto-Scaling组中,并定义有关如何扩展实例的策略。 如果您有预测性的工作负载,则可以设置一个策略,说在星期三将实例数增加到5;如果您有不可预测的工作负载,则可以基于各种参数(例如CPU或内存使用率)来设置策略。 假设我的实例的CPU利用率超过80%,则实例数增加1。

We can also set up an scale in policy that will ensure that we don’t over provision instances that are of no use. So we can set a policy that says remove instances if the CPU utilization is below 20%. In this way, you can automate the process of scaling in and out instances with no manual intervention. Auto-Scaling ensures high availability and when used along with load balancer can help us provide quality service to our customers.

我们还可以在策略中设置规模,以确保我们不会过度配置无用的实例。 因此,我们可以设置一个策略,如果CPU利用率低于20%,则删除实例。 这样,您无需手动干预即可自动执行扩展和扩展实例的过程。 自动扩展可确保高可用性,并且与负载平衡器一起使用时,可以帮助我们为客户提供优质的服务。

Auto Scaling group

结论: (Conclusion:)

EC2 is one of the most popular offerings of AWS and there is much more to discuss and learn in EC2.

EC2是AWS最受欢迎的产品之一,在EC2中还有更多的讨论和学习。

翻译自: https://medium.com/swlh/ec2-the-heart-of-aws-7452889f20f2

aws ec2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值