aws cloud map
Amazon EC2 is an abbreviation for Elastic Compute Cloud. It’s elastic in nature which means you can scale it at any point in time. It’s very hard to predict the compute power for application deployment. Sometimes, you need more compute power and sometimes less. In both cases, you have to decide the compute power well in advance. Because it takes a lot of time in the procurement of hardware resources and set them up.
Amazon EC2是Elastic Compute Cloud的缩写。 它具有弹性,这意味着您可以在任何时间缩放它。 很难预测应用程序部署的计算能力。 有时,您需要更多的计算能力,而有时则需要更少的计算能力。 在这两种情况下,您都必须提前确定计算能力。 因为在采购硬件资源和建立它们方面花费大量时间。
AWS EC2 solves on-demand scalability issue of the On-premises deployment. In this tutorial, we will launch an AWS EC2 Linux instance to understand the concept.
AWS EC2解决了本地部署的按需可伸缩性问题。 在本教程中,我们将启动一个AWS EC2 Linux实例以了解该概念。
什么是Amazon EC2? (What is Amazon EC2?)
Amazon Elastic Compute Cloud (Amazon EC2) provides elastic computing capacity in the Amazon Cloud. When we say elastic that means it’s scalable at any point in time. With the Amazon EC2, you can launch as many virtual machines as you want. Which reduces the upfront cost of hardware purchase. You can grow or replicate your infrastructure services as your business grow.
Amazon Elastic Compute Cloud(Amazon EC2)在Amazon Cloud中提供弹性计算能力。 当我们说弹性的时候,这意味着它可以在任何时间扩展。 使用Amazon EC2,您可以启动任意数量的虚拟机。 这减少了硬件购买的前期成本。 随着业务增长,您可以增长或复制基础结构服务。
AWS provides you with the web interface to launch the AWS EC2 instance. It provides ready to instantiate AMIs (Amazon Machine Images) to quickly launch an EC2 instance.
AWS为您提供了用于启动AWS EC2实例的Web界面。 它提供了实例化AMI(Amazon Machine Images)的准备,以快速启动EC2实例。
If you are not familiar with Cloud Computing then read our post on “Overview of Cloud Computing” and “Amazon Web Services (AWS)”.
如果您不熟悉云计算,请阅读我们关于“云计算概述”和“亚马逊网络服务(AWS)”的文章 。
服务与实例 (Service vs Instance)
It may be confusing for beginners that sometimes we say service and sometimes instance. So, EC2 is web service provided by AWS but we use it through an instance like t2.large instance.
对于初学者而言,有时我们称其为服务而有时又称其为实例,可能会造成混淆。 因此,EC2是由AWS提供的Web服务,但是我们通过t2.large实例之类的实例来使用它。
In general, a machine instance is a virtual machine running in the cloud. All applications that you deploy run on this virtual machine itself. These virtual computing environments are knowns as instances.
通常,机器实例是在云中运行的虚拟机。 您部署的所有应用程序都在此虚拟机本身上运行。 这些虚拟计算环境称为实例。
为什么选择EC2? (Why EC2?)
One of the key reason for using AWS EC2 is the opportunity to replace upfront infrastructure expenses with low variable costs that can scale with your business.
使用AWS EC2的关键原因之一是有机会用可以随您的业务扩展的低可变成本来代替前期基础架构费用。
Let’s talk about the more exciting features that AWS EC2 offers.
让我们谈谈AWS EC2提供的更多激动人心的功能。
- It provides the virtual computing environment known as instances. 它提供了称为实例的虚拟计算环境。
- EC2 service is elastic in nature – Scale when your business grow. EC2服务本质上是弹性的–随着业务增长而扩展。
- Pay-as-you-go pricing model. 现收现付定价模式。
- Preconfigured templates available for your instances, known as AMI (Amazon Machine Images). 可用于您的实例的预配置模板,称为AMI(Amazon Machine Images) 。
- Web interface available to do the various configurations of CPU, memory, storage, and networking capacity. Web界面可用于执行CPU,内存,存储和网络容量的各种配置。
- Elastic Ip addresses are available – Static Ip address for your dynamic cloud computing. 弹性IP地址可用–动态云计算的静态IP地址。
- Secure login for your instances with key pair (Public Key and Private Key). 使用密钥对(公钥和私钥)对实例进行安全登录。
- Persistent storage volumes for your data known as Amazon Elastic Block Storage (Amazon EBS). 数据的永久存储卷称为Amazon Elastic Block Storage(Amazon EBS)。
- Highly Reliable – multiple physical locations for your data. 高度可靠–您数据的多个物理位置。
- Integrated Environment – EC2 is integrated with almost every service available on AWS. You do not need to do POCs (Proof of Concept) and research. 集成环境– EC2与AWS上几乎所有可用的服务集成。 您无需进行POC(概念验证)和研究。
- No additional IT team is required to manage your deployment. 无需其他IT团队即可管理您的部署。
- You are not buying hardwares – You can release services whenever you want without worrying about the investment cost. 您无需购买硬件–您可以随时发布服务,而不必担心投资成本。
You will find many reasons why to use AWS EC2 when you will actually start using it. Tell us your favorite reason in the comment section.
在实际开始使用AWS EC2时,您会发现许多原因。 在评论部分告诉我们您最喜欢的原因。
EC2实例类型 (EC2 Instance Types)
AWS offers several EC2 instance types and each of them is for particular use cases. Each instance type offers a different memory, computer, and storage capabilities.
AWS提供了几种EC2实例类型,每种类型都用于特定的用例。 每种实例类型都提供不同的内存,计算机和存储功能。
AWS grouped EC2 instances based on these capabilities and provides the below-listed instance types:
AWS根据这些功能将EC2实例分组,并提供以下实例类型:
通用实例 (General Purpose Instance)
These instances provide a good balance of memory, computer, storage, and networking resources. And can be used in a variety of use cases and workloads.
这些实例在内存,计算机,存储和网络资源之间提供了很好的平衡。 并且可以在各种用例和工作负载中使用。
T2和T3实例 (T2 and T3 Instances)
T2 and T3 are the Burstable Performance Instances. These instances provide you the baseline CPU performance but have the ability to burst to a higher level based on the workload.
T2和T3是Burstable性能实例 。 这些实例可为您提供基准CPU性能,但可以根据工作负载而达到更高的水平。
These are only instances which use the credits for CPU usage. Just for your information “One CPU credit is equal to one vCPU running at 100% utilization for one minute.”
这些仅是将积分用于CPU使用的实例。 仅供参考: “一个CPU信用等于一个以100%利用率运行一分钟的vCPU。”
These instance types are the perfect candidates for :
这些实例类型非常适合:
- Web Applications 网络应用
- Websites 网站
- Microservices 微服务
- Code Repositories etc. 代码库等
M4,M5,M5a和M5d实例 (M4, M5, M5a, and M5d Instances)
These instances are well suited for below type of applications:
这些实例非常适合以下类型的应用程序:
- Web Servers 网络服务器
- Application Servers 应用服务器
- Small and Medium databases 中小型数据库
- Gaming Servers 游戏服务器
A1实例 (A1 Instance)
These instances are well suited for below type of applications:
这些实例非常适合以下类型的应用程序:
- Distributed data stores 分布式数据存储
- Containerized Microservices 容器化微服务
- Web Servers etc. 网络服务器等
You can check the summary of hardware specification like default vCPUs, Memory (GiB) on AWS. Based on you hardware requirement you can choose the machine type.
您可以检查硬件规格摘要,例如默认vCPU,AWS上的内存(GiB)。 根据您的硬件要求,您可以选择机器类型。
计算优化实例 (Compute Optimized Instance )
Compute-optimized instances focus on providing you the high-performance processors. These types of instances are ideal for compute-bound applications.
经过计算优化的实例致力于为您提供高性能处理器。 这些类型的实例非常适合计算绑定的应用程序。
C系列(C4,C5,C5d和C5n)实例 (C series (C4, C5, C5d, and C5n) Instances)
These are the good candidates for below types of applications:
这些是以下类型应用程序的不错选择:
- High-performance computing 高性能计算
- Batch Processing 批量处理
- Compute Intensive Applications 计算密集型应用
- Machine Learning etc. 机器学习等
内存优化实例 (Memory Optimized Instance )
As per the name suggests these are designed to provide you fast performance on the large dataset in memory. Memory Optimized instances are being used mainly for the database services.
顾名思义,它们旨在为您提供内存中大型数据集的快速性能。 内存优化实例主要用于数据库服务。
R系列(R4,R5,R5a和R5d)实例 (R Series(R4, R5, R5a, and R5d) Instances)
These types of instances are the good candidates for the below types of applications:
这些类型的实例是以下类型的应用程序的不错的选择:
- High-performance relational and NoSQL databases like MySQL and MongoDB 高性能关系数据库和NoSQL数据库,例如MySQL和MongoDB
- In memory caching – Redis and Memcache 内存缓存– Redis和Memcache
- Big Data like Hadoop/Spark clusters Hadoop / Spark集群等大数据
加速计算实例 (Accelerated Computing Instance)
These instances provide very high processing capability for the GPUs (Graphics Processing Units). There are several instance types available under the Accelerated Computing Instance like F1, P2, P3, G2 and G3.
These are well suited for the below types of applications:
这些实例为GPU(图形处理单元)提供了非常高的处理能力。 加速计算实例下有几种实例类型可用,例如F1,P2,P3,G2和G3。
这些非常适合以下类型的应用程序:
- Video Creation Services 视频创作服务
- 3D Visualization 3D可视化
- Video Encoding 视频编码
- Virtual Reality 虚拟现实
- Deep Learning 深度学习
- Molecular Modeling etc. 分子建模等
存储优化实例 (Storage Optimized Instance )
Storage Optimized Instances are highly optimized to provide low latency, IOPS (I/O operations per second) to your application.
存储优化实例经过高度优化,可为您的应用程序提供低延迟的IOPS(每秒I / O操作)。
H1实例 (H1 Instances )
These instances are the good candidates for the below type of applications:
这些实例是以下类型应用程序的不错的选择:
- MapReduce and distributed file system MapReduce和分布式文件系统
- Require high-throughput access to the big chunk of data 要求高吞吐量访问大量数据
D2实例 (D2 Instances)
D2 instances are the well suited for the below types of applications:
D2实例非常适合以下类型的应用程序:
- Parallel Processing 并行处理
- Log processing applications 日志处理应用
- Data processing applications 数据处理应用
I3实例 (I3 Instances)
I3 instances are the well suited for the below types of applications:
I3实例非常适合以下类型的应用程序:
- Relational Databases 关系数据库
- NoSQL Databases NoSQL数据库
- In-Memory Databases (like Redis) 内存数据库(如Redis)
- Online Transaction processing (OLTP) systems 在线交易处理(OLTP)系统
AMI的实例 (Instances from AMIs )
AMI is an abbreviation for the Amazon Machine Image which provides the essential information to launch a virtual machine in cloud. You can launch multiple identical instances from an AMI.
AMI是Amazon Machine Image的缩写,提供了在云中启动虚拟机的基本信息。 您可以从AMI启动多个相同的实例。
An AMI contains three things:
AMI包含三件事:
- Template – For the root volume for the instances (An application server, an OS, and applications) 模板–用于实例的根卷(应用程序服务器,操作系统和应用程序)
- Permissions to Launch – Which account can use this AMI to launch instances 启动权限–哪个帐户可以使用此AMI启动实例
- Block device mapping 块设备映射
We will discuss the Amazon Machine Images in detail in a separate post. There we will learn how to create, register, use and deregister the AMIs.
我们将在另一篇文章中详细讨论Amazon Machine Images。 在那里,我们将学习如何创建,注册,使用和注销AMI。
设置AWS EC2 (Setup AWS EC2)
Most of the services provided by AWS are linked together. So, let’s launch a Linux EC2 instance and explore the services for how they work.
AWS提供的大多数服务都链接在一起。 因此,让我们启动一个Linux EC2实例,并探索服务的工作方式。
配置 (Setting Up)
To get started, make sure that you have an account on AWS and that has been activated.
首先,请确保您已经在AWS上拥有一个账户且该账户已被激活。
- Login to AWS Console 登录到AWS控制台
- Explore the Services Tab 浏览服务选项卡
- Search for EC2 搜索EC2
- Click on EC2 service under Compute – Note: If you have already used it then it will appear in history section as well. 单击“计算”下的EC2服务-注意:如果您已经使用过它,那么它也将出现在“历史记录”部分中。
If you are able to perform all the above actions then you are good to go. Let’s launch a instance now.
如果您能够执行上述所有操作,那么您就可以进行了。 现在启动一个实例。
启动实例 (Launch Instance )
You will redirected to the EC2 dashboard. You will see something like the below screen. In the middle section, you see two things:
您将重定向到EC2仪表板。 您将看到类似以下屏幕的内容。 在中间部分,您看到两件事:
- Resources – Currently we have zero instances running. 资源–当前,我们有零个实例在运行。
- Create Instance – To launch the new virtual instances. 创建实例–启动新的虚拟实例。
Click on the “Launch Instance” button.
单击“启动实例”按钮。
步骤1:选择AMI (Step 1: Choose AMI )
I will choose an existing AMI to launch the virtual machine. If you see there is a section in “My AMIs” for the images that you created.
我将选择一个现有的AMI启动虚拟机。 如果看到“我的AMI”中包含您创建的图像的部分。
To give you a quick start, AWS provides you with a number of Amazon Machine Images (AMI) by default. We are going to use Linux instance from AMI “Amazon Linux 2 AMI [HVM], SSD Volume Type”.
为了让您快速入门,AWS默认为您提供了许多Amazon Machine Images(AMI)。 我们将使用AMI中的Linux实例“ Amazon Linux 2 AMI [HVM],SSD Volume Type” 。
Click on the “Select” AMI and continue.
单击“选择” AMI,然后继续。
步骤2:选择实例类型 (Step 2: Choose Instance Type )
Now, you will see the list of instance types that we were just talking about. You can filter and find the instance type that you want based on your use case.
现在,您将看到我们刚才讨论的实例类型的列表。 您可以根据用例筛选并找到所需的实例类型。
I’m choosing t2.micro type, since it’s free tier and my account, is eligible. So I will get by default: t2.micro (Variable ECUs, 1 vCPUs, 2.5 GHz, Intel Xeon Family, 1 GiB memory, EBS only)
我选择的是t2.micro类型,因为它是免费套餐 ,并且我的帐户可以使用。 因此,我将默认获得: t2.micro(可变ECU,1个vCPU,2.5 GHz,Intel Xeon家族,1 GiB内存,仅EBS)
Clicking on “Review and Launch” will launch the instance with the default settings. Click on the “Next: Configure Instance Details”.
单击“查看并启动”将使用默认设置启动实例。 单击“下一步:配置实例详细信息” 。
步骤3:配置实例 (Step 3: Configure Instance )
You will see the below screen with several configuration options:
您将看到以下屏幕,其中包含几个配置选项:
- Number of Instances – You can choose to launch more than one instance at a time.
Note : Please ignore the “Launch into Auto-scaling Group” for now. We will talk about this in scaling up your application. 实例数–您可以选择一次启动多个实例。
注意:请暂时忽略“启动自动缩放组”。 我们将在扩展您的应用程序时讨论此问题。 - Purchasing Option – Check this if you want to buy Spot Instances. This lets you specify the maximum price you are willing to pay per instance hour. 购买选项–如果要购买竞价型实例,请选中此选项 。 这使您可以指定愿意为每个实例小时支付的最高价格。
- Network – AWS create a default VPC for you. You can create a VPC and select your own IP address range, create subnets, configure route tables, and configure network gateways. 网络– AWS为您创建一个默认VPC。 您可以创建一个VPC并选择自己的IP地址范围,创建子网,配置路由表以及配置网络网关。
- Subnet – is a range of IP addresses in your VPC that can be used to isolate different EC2 resources from each other or from the Internet. 子网–是VPC中的IP地址范围,可用于将不同的EC2资源彼此隔离或与Internet隔离。
- Capacity Reservation – reserve capacity for your EC2 instances in a specific Availability Zone 容量预留–在特定的可用区中为EC2实例预留容量
You can leave all the options with their default values for now. I just wanted to let you know that what are these options and their usage.
您现在可以保留所有选项的默认值。 我只是想让您知道这些选项及其用途。
Now, click on “Next: Add Storage” button.
现在,单击“下一步:添加存储”按钮。
步骤4:添加存储 (Step 4: Add Storage )
Let’s add storage to your instance. One thing to notice here is that default Size (GiB) is 8 GiB. You can add the storage that you want.
让我们为实例添加存储。 这里要注意的一件事是默认大小(GiB)为8 GiB。 您可以添加所需的存储。
Note : Free tier eligible customers can get up to 30 GB of EBS General Purpose (SSD) or Magnetic storage.
注意:符合条件的免费套餐客户可以获取高达30 GB的EBS通用(SSD)或磁性存储。
Delete on Termination – EBS volumes persist independently from the running life of an EC2 instance. After 12 months if you don’t pay then AWS will delete the storage on termination.
终止时删除– EBS卷的持久性独立于EC2实例的运行寿命。 12个月后,如果您不付款,AWS将在终止时删除存储。
Now, click on the “Next: Add Tags” button.
现在,单击“下一步:添加标签”按钮。
第5步:添加标签 (Step 5: Add Tag )
Tags are used to label an AWS resource. Tag consist of a key and pair(optional). See the below screen:
标签用于标记AWS资源。 标签由密钥和配对(可选)组成。 请参阅以下屏幕:
Now, click on the “Next: Configure Security Group” button.
现在,单击“下一步:配置安全组”按钮。
步骤6:配置安全组 (Step 6: Configure Security Group )
Security groups control the traffic to reach your instance. You allow certain ports and protocols to get access.
安全组控制流量以到达您的实例。 您允许某些端口和协议进行访问。
Note: Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. It highly recommends setting security group rules to allow access from known IP addresses only.
注意:源为0.0.0.0/0的规则允许所有IP地址访问您的实例。 强烈建议将安全组规则设置为仅允许从已知IP地址进行访问。
Now, It’s time to review the instance that we configured and launch it by clicking “Review and Launch”.
现在,是时候查看我们配置的实例并通过单击“ Review and Launch”启动它了。
步骤7:审查执行个体 (Step 7: Review Instance)
Now, It’s time to see your instance before launch. A review screen will all the options and details that you have selected in the above steps.
现在,是时候在启动之前查看您的实例了。 查看屏幕将显示您在上述步骤中选择的所有选项和详细信息。
步骤8:创建密钥对 (Step 8: Create Key Pair)
Now, please create a key pair. A key pair consists of two keys 1) Public Key 2) Private key. Key will allow you to connect your instance securely.
现在,请创建一个密钥对。 密钥对包括两个密钥1)公钥2)私钥。 密钥可让您安全地连接实例。
Note: Please make sure that you store the .pem file somewhere securely on your Desktop system for further use.
Finally, launch instance by clicking the “Launch Instances” button.
注意:请确保将.pem文件安全地存储在台式机系统上的某个位置,以备将来使用。
最后,通过单击“启动实例”按钮启动实例 。
启动实例状态 (Launch Instance Status)
AWS takes a few minutes to launch your instance. You will see the below screens while AWS is processing in the back for your instance.
AWS需要几分钟来启动您的实例。 当AWS在为您的实例的背面处理时,您将看到以下屏幕。
Once the instantiation has been completed you will be shown another intermediate status screen. This is in case you want to see the logs of instance launch.
实例化完成后,将显示另一个中间状态屏幕。 这是在您要查看实例启动日志的情况下。
On this screen, scroll down and you will see a button “View Instance”.
在此屏幕上,向下滚动,您将看到“查看实例”按钮。
查看EC2实例 (View EC2 Instance)
Now, your instance has been launched and you can see the instance details on the same Dashboard from where we started in Step -1.
现在,您的实例已启动,您可以在我们从步骤-1开始的同一仪表板上看到实例详细信息。
See in the left toolbar there are many options available. We will talk about each of them in detail in other posts to give you end-to-end understanding.
请参阅左侧工具栏中的许多选项。 我们将在其他帖子中详细讨论它们中的每一个,以使您对端到端有所了解。
连接到EC2实例 (Connect to EC2 Instance)
You can directly click on the “Connect” button. OR Click on the button “Actions” on the top and you will see the below options.
您可以直接单击“连接”按钮。 或单击顶部的“操作”按钮,您将看到以下选项。
On clicking “Connect” button, you will see the below options to connect to your EC2 instance.
单击“连接”按钮后,您将看到以下选项以连接到您的EC2实例。
Connecting through the SSH is straight forward, you can use console or putty to connect through the SSH client.
通过SSH连接很简单,您可以使用控制台或腻子通过SSH客户端进行连接。
I will show you how to connect through a Java SSH Client from your browser. Make sure that you have Java installed on your machine. Otherwise, this option will not work for you.
我将向您展示如何从浏览器通过Java SSH客户端进行连接。 确保在计算机上安装了Java。 否则,此选项将对您不起作用。
Give the path of the key file “journaldev.pem” from your local machine. That’s it. Click on the “Launch SSH Client” and you are done.
提供本地计算机上的密钥文件“ journaldev.pem”的路径。 而已。 单击“启动SSH客户端” ,您就完成了。
终止EC2实例 (Terminate EC2 Instance)
You can terminate the EC2 instance at any point in time. Click on the “Actions > Instance State”, you will see the last option in the dropdown “Terminate”.
您可以随时终止EC2实例。 单击“操作>实例状态” ,您将在下拉菜单“终止”中看到最后一个选项。
翻译自: https://www.journaldev.com/25365/amazon-ec2-aws-elastic-compute-cloud
aws cloud map