aws技术栈_全栈工程师应注意的基本AWS服务

aws技术栈

After a couple of months playing around with AWS and developing web applications with it, I would like to describe the top services I found myself using the most.

在使用AWS并开发Web应用程序几个月后,我想描述一下我发现自己使用最多的顶级服务。

This article is, for sure, not a detailed guide of AWS services, as it is intended to be an introductory article about the world of AWS, written by a full stack developer for all the rest of the full stack engineers out there 🌎.

当然,本文不是AWS服务的详细指南,因为它旨在成为有关AWS世界的入门文章,由全栈开发人员为那里的所有其余全栈工程师撰写🌎。

This list can and should be considered subjective. However, if you’re in the web development industry, chances are high that you will use most of the below Amazon Services. So, let’s get to it! 🔥

此列表可以并且应该被认为是主观的。 但是,如果您从事的是Web开发行业,则很有可能会使用下面的大多数Amazon Services。 所以,让我们开始吧! 🔥

Amazon EC2(虚拟机-后端应用程序的地方) (Amazon EC2 (Virtual Machines —A place for your Backend Apps))

EC2, also called Elastic Compute Cloud, is an essential service that Amazon offers. You will make use of it either directly, or through another AWS Service, but you just can’t run from it.

EC2 ,也称为弹性计算云,是亚马逊提供的一项基本服务。 您将直接或通过另一个AWS服务来使用它,但是您无法从中运行它。

EC2’s are simple virtual machines. They come in a range of sizes, from basic machines to incredible powerhouses. However, if you’re a web developer and your application doesn’t attract millions of users, you will mostly use the low or mid tier ones.

EC2是简单的虚拟机 。 它们的大小不一,从基本机器到强大的机器。 但是,如果您是Web开发人员,并且您的应用程序没有吸引数百万的用户,则通常会使用低端或中端用户。

EC2s are crucial for any web app which has a backend component (just think of any backend service written in Java, JavaScript on Node, Go, Python and so on). You need to run those apps somewhere. That’s where an EC2 virtual machine helps.

EC2对于任何具有后端组件的Web应用程序都是至关重要的(想想用Java,Node上JavaScript,Go,Python等编写的任何后端服务)。 您需要在某个地方运行这些应用程序 这就是EC2虚拟机提供帮助的地方。

Image for post
The EC2 symbol
EC2符号

负载平衡器(后端应用程序的联系点) (Load Balancers (Point of Contact with your Backend Apps))

Let’s presume that you’ve set up your backend application to run on an EC2 machine. Great! However, usually you should not make the EC2 machine publicly available. It’s good to have another layer in front of it. This is where load balancers come into play.

假设您已经设置了后端应用程序以在EC2机器上运行。 大! 但是,通常不应将EC2计算机公开。 这是件好事,在其前面的另一个 。 这是负载平衡器起作用的地方。

As the name suggest, load balancers… balance the load, right? The load in this context are the requests coming from the clients, i.e. the calls from the frontend (or frontends) — React, Vue, Angular, Android TV, another backend service, iOS app, your smart fridge and whatnot.

顾名思义,负载均衡器...可以均衡负载,对吗? 在这种情况下, 负载是来自客户端的请求,即来自前端(或多个前端 )的调用-React,Vue,Angular,Android TV,另一个后端服务,iOS应用程序,您的智能冰箱以及其他。

Balancing the load means splitting it, or routing it to multiple machines so none of them gets overwhelmed.

平衡负载意味着拆分 ,或路由到多台计算机,以使它们不被淹没。

Now comes the fun and interesting part. You will not use a load balancer solely for load balancing. You will, in many cases, use a load balancer with only one EC2 machine. Why? Because a load balancer offers much more than load balancing.

现在是有趣和有趣的部分。 您将不会仅将负载均衡器用于负载均衡。 在许多情况下,您只会在一台 EC2计算机上使用负载平衡器。 为什么? 因为负载均衡器提供的不仅仅是负载均衡。

A load balancer can easily integrate with HTTPS certificates bought through AWS. Thus, it takes just one click to make your domain secure.

负载均衡器可以轻松地与通过AWS购买的HTTPS证书集成。 因此,只需单击一下即可确保您的域安全。

Also, it is easy to set up health checks which monitor the status of the EC2 instances your LB is routing to.

同样,很容易设置运行状况检查,以监视LB路由到的EC2实例的状态。

In addition, it is really easy to configure a custom domain name to point to your load balancer, as Route53 (the DNS service of AWS) integrates smoothly with load balancers.

此外,将Route53 (AWS的DNS服务)与负载均衡器平稳集成,配置自定义域名指向负载均衡器确实非常容易。

AWS’s load balancers are called the Elastic Load Balancers.

AWS的负载均衡器称为Elastic Load Balancers

Image for post
The Elastic Load Balancer symbol
弹性负载均衡器符号

Route53(DNS服务-人们如何找到您的应用程序) (Route53 (DNS Service — this is how People find your App))

AWS Route53 (a nice reference to the U.S. Route 66) is the DNS service that Amazon offers.

AWS Route53 (很好地引用了美国Route 66)是Amazon提供的DNS服务。

You can easily configure where your custom domains should point to (maybe an Elastic Load Balancer, EC2 instance, CloudFront distribution, S3 bucket and so on).

您可以轻松配置自定义域应指向的位置(例如,Elastic Load Balancer,EC2实例,CloudFront发行版,S3存储桶等)。

You can also buy custom domains through Route53. AWS’s DNS service is just an essential service to know.

您也可以通过Route53购买自定义域。 AWS的DNS服务只是一项必不可少的服务。

Image for post
The Route53 symbol
Route53符号

S3(存放前端和其他资产的地方) (S3 (A place for your Frontend & other Assets))

Amazon’s Simple Storage Service (S3) is one of its core services.

亚马逊的简单存储服务(S3)是其核心服务之一。

Essentially, it is a simple file storage service, which uses the term buckets to describe different groups (buckets) of files.

本质上,它是一个简单的文件存储服务,它使用术语存储桶来描述不同的文件组( 存储桶 )。

You can store pictures, videos, documents — basically any kind of assets that your business logic needs.

您可以存储图片,视频,文档-基本上是您的业务逻辑所需的任何资产。

The files can remain private — accessible only from your backend services, or they can be made public — to be accessible from the frontends.

这些文件可以保持私有状态(只能从您的后端服务访问,或者可以将其公开),以便可以从前端访问。

An S3 bucket is able to host and serve your frontend project as well, and this is, actually, the preferred approach for hosting your client facing web apps. You should never serve your frontends, which require no server side processing, from EC2 instances, as it is highly inefficient (both from a speed and price point of view).

S3存储桶也能够托管和服务您的前端项目,实际上,这是托管面向客户端的Web应用程序的首选方法。 您绝对不应该从EC2实例中为不需要服务器端处理的前端提供服务,因为它效率极低 (从速度价格的角度来看)。

However, if you use SSR (server side rendering) then you will, unfortunately, need to use a processing service as well (like an EC2 machine or AWS Lambda).

但是,如果您使用SSR (服务器端渲染),那么不幸的是,您还需要使用处理服务(例如EC2计算机或AWS Lambda)。

Image for post
The symbol for an S3 bucket
S3存储桶的符号

CloudFront(CDN-存放前端和资产的快速地方) (CloudFront (CDN — a fast Place for your Frontend & Assets))

A Content Delivery Network (or CDN), such as CloudFront, serves your frontend (and assets) much faster to your clients, as it consists of a number of distributed systems from all around the world which serve the clients in the shortest time possible.

内容交付网络 (或CDN)(例如CloudFront)可以更快地为您的客户端提供前端(和资产)服务,因为它由来自世界各地的许多分布式系统组成,可以在最短的时间内为客户提供服务。

The high level steps for hosting your frontend on CloudFront are the following:

在CloudFront上托管前端的高级步骤如下:

  1. Build your frontend (minify assets, bundle files etc.)

    构建您的前端(最小化资产,捆绑文件等)
  2. Push the build to an S3 bucket

    将构建推送到S3存储桶
  3. Configure a CloudFront distribution to serve the files from your S3 bucket

    配置CloudFront分发以提供S3存储桶中的文件

  4. Let your clients enjoy super fast loading times 🚀

    让您的客户享受超快速的加载时间🚀
Image for post
The CloudFront symbol
CloudFront符号

RDS(用于存储您的关系数据) (RDS (to store your Relational Data))

Many applications require a relational database.

许多应用程序需要一个关系数据库。

Amazon’s RDS — Relational Database Service is a simple, hosted service, which offers various database engines to choose from, like MySQL, Oracle DB, PostgreSQL.

亚马逊的RDS —关系数据库服务是一种简单的托管服务,它提供各种数据库引擎供您选择,例如MySQL,Oracle DB,PostgreSQL。

It is easy to configure and scale. This is definitely a service of AWS that you must know of.

易于配置和扩展。 这绝对是您必须了解的AWS服务。

AWS also offers NoSQL solutions, should your data model require it. AWS’s DynamoDB and DocumentDB are here to make that happen.

如果您的数据模型需要,AWS还提供NoSQL解决方案。 AWS的DynamoDB和DocumentDB可以实现这一目标。

Image for post
The RDS symbol
RDS符号

ECS + ECR =❤️(运行您的容器化应用程序) (ECS + ECR = ❤️ (to run your containerized apps))

It is just really elegant to run your backend applications in a containerized fashion. It makes spinning up an instance (or 100) absolutely easy-peasy.

以容器化的方式运行后端应用程序确实很优雅。 它使旋转一个实例(或100个实例)变得绝对容易。

This is where ECS — the Elastic Container Service comes into play. ECS lets you run an application in a container. Just give ECS the Docker image to run, and it will take care of the rest.

这就是ECS( 弹性容器服务)发挥作用的地方。 通过ECS,您可以在容器中运行应用程序。 只需为ECS提供Docker映像即可运行,其余的将由它负责。

ECR — the Elastic Container Registry is a place where you can store your Docker images, which run in ECS (but you can use any other image registry/ artifactory as well).

ECR — Elastic Container Registry是一个可以存储在ECS中运行的Docker映像的地方(但您也可以使用任何其他映像注册表/工件)。

There are 2 ways you can run your containers. You can use your EC2 machines as the infrastructure that ECS runs your containers on, or you can tell AWS “hey, I need this much CPU power and that much ram for this container”, and AWS will take care of the infrastructure. This feature is enabled by a separate AWS service (which is tightly integrated with ECS) called AWS Fargate.

有两种方法可以运行容器。 您可以将EC2机器用作ECS在其上运行容器的基础架构,也可以告诉AWS“嘿,我需要这么多的 CPU能力和该容器所需的大量内存”,AWS会照顾好基础架构。 此功能由称为AWS Fargate的单独AWS服务(与ECS紧密集成)启用。

Image for post
The ECS + ECR symbols
ECS + ECR符号

请记住其他服务 (Other services to keep in mind)

AWS IAM(身份和访问管理) (AWS IAM (Identity and Access Management))

If you’d like to give a team member permission to access your AWS services, you will need to create an account and give permissions to use certain services. This happens through AWS’s IAM.

如果您想授予团队成员访问您的AWS服务的权限,则需要创建一个帐户并授予使用某些服务的权限。 这是通过AWS的IAM发生的。

Also, if you’d like to integrate a CI/CD pipeline which, for example, pushes another Docker image to ECR and loads that in ECS (the container service) then you will need to create a programmatic IAM account, so the pipeline will have access to your AWS services.

另外,如果您想集成一个CI / CD管道,例如,将另一个Docker映像推送到ECR并将其加载到ECS (容器服务)中,那么您将需要创建一个程序化IAM帐户,因此该管道将有权访问您的AWS服务。

AWS Elastic Beanstalk (AWS Elastic Beanstalk)

Amazon’s Elastic Beanstalk is a great service which abstracts away the complexity behind deploying a web application to AWS.

亚马逊的Elastic Beanstalk是一项出色的服务,它消除了将Web应用程序部署到AWS背后的复杂性。

It actually supports code upload, that is, you can upload your project and it will take care of the infrastructure and required AWS services (like databases, EC2 machines and so on).

它实际上支持代码上传,也就是说,您可以上传您的项目,它将处理基础架构和所需的AWS服务(例如数据库,EC2计算机等)。

If you’d like to deepen your knowledge about AWS services, I’d recommend not using this service. Getting hands-on, lower-level AWS experience is pure gold.

如果您想加深对AWS服务的了解,建议您不要使用此服务。 亲身体验较低级别的AWS经验是纯金。

AWS SQS和SNS (AWS SQS & SNS)

Amazon’s Simple Queue Service and Simple Notification Service are crucial when it comes to application integration.

当涉及到应用程序集成时,Amazon的Simple Queue ServiceSimple Notification Service是至关重要的。

If you have multiple backend apps which need to communicate or notify each other about certain events, then these 2 services are important to keep in mind.

如果您有多个后端应用程序需要就某些事件进行通信或相互通知,那么请牢记这两项服务。

Just to give an example, I’ve used SQS & SNS before in an application which had a separate service that generated a PDF document based on some data.

举个例子,我以前在一个应用程序中使用过SQS和SNS ,该应用程序有一个单独的服务,该服务根据一些数据生成PDF文档。

All the tasks for creating PDFs were put in the SQS queue. The PDF generator app would then read from this queue and generate the documents in its own pace. When a PDF was ready, a notification was sent out to the PDF requesting applications (the consumers) via SNS.

创建PDF的所有任务都放在了SQS 队列中 。 然后,PDF生成器应用将从该队列中读取并以自己的进度生成文档。 当PDF准备就绪时,会通过SNS将通知发送到PDF请求应用程序( 使用者 )。

This is a great example for application decoupling. The PDF exporter was asynchronously processing the export jobs, thus none of the applications were being synchronously blocked and waiting. Also, the PDF document was stored in an S3 bucket 😉.

这是应用程序解耦的一个很好的例子。 PDF导出器正在异步处理导出作业,因此没有应用程序被同步阻止和等待。 另外,PDF文档被存储在S3存储桶😉中。

适用于日志的AWS CloudWatch (AWS CloudWatch for logs)

Logging is super helpful in applications. There are numerous SaaS companies which offer logging solutions. I’ve tried AWS’s as well, which is integrated into CloudWatch.

日志记录在应用程序中非常有用。 有许多提供记录解决方案的SaaS公司。 我也尝试过将AWS集成到CloudWatch中。

You can easily set up log groups, write and then analyze the logs.

您可以轻松设置日志组,编写然后分析日志。

AWS Kubernetes服务 (AWS Kubernetes Service)

Clearly there is a Kubernetes hype going on in our present days.

显然,在当今时代,有一种Kubernetes的炒作正在进行。

I honestly think that most projects, unless they’re huge and have great financing, do not need Kubernetes. It is clearly a popular technology, but we shouldn’t use technologies only for the sake of being popular or hyped.

老实说,我认为大多数项目,除非它们是巨大的并且有足够的资金,否则都不需要Kubernetes。 显然,这是一种流行的技术,但是我们不应该仅仅为了变得流行或被炒作而使用技术。

That being said, AWS offers a Kubernetes service as well, that is called EKS — Elastic Kubernetes Service.

话虽这么说,AWS还提供了Kubernetes服务,即EKS — Elastic Kubernetes Service

AWS Lambda (AWS Lambda)

FaaS (function as a service) products have also grown in popularity. The serverless model allows developers to run their code without having to manage the underlying infrastructure (sounds familiar? ECS with Fargate sort of does the same thing).

FaaS (即服务) 产品也越来越受欢迎。 无服务器模型允许开发人员无需管理基础架构即可运行其代码(听起来很耳熟?带有Fargate的ECS可以做到这一点)。

It is interesting to just write a function in JavaScript, push it to AWS Lambda, and see it execute whenever, for example, an HTTP request hits it. And you only pay for execution time 💰.

有趣的是,仅使用JavaScript编写一个函数,将其推送到AWS Lambda,并在例如HTTP请求命中该函数时执行该函数。 而且您只需支付执行时间💰。

All in all, FaaS solutions, like AWS Lambda, are awesome to explore but it might be difficult to find a suitable use case for them in small to medium projects, as they come with certain potential disadvantages, like cold start.

总而言之,像AWS Lambda这样的FaaS解决方案非常值得探索,但在中小型项目中可能很难找到适合他们的用例,因为它们具有某些潜在的缺点,例如冷启动

在结束时 (In closing)

Thank you for reading this article all the way to the end!

感谢您一直阅读本文!

I hope it gave you enough information so you can start or continue exploring the huge but beautiful world of Amazon Web Services.

我希望它能为您提供足够的信息,以便您可以开始或继续探索庞大而美丽的Amazon Web Services世界。

进一步阅读 (Further reading)

  1. https://aws.amazon.com/getting-started/hands-on/deploy-nodejs-web-app/

    https://aws.amazon.com/getting-started/hands-on/deploy-nodejs-web-app/

  2. https://aws.amazon.com/blogs/aws/

    https://aws.amazon.com/blogs/aws/

  3. https://aws.amazon.com/ec2/

    https://aws.amazon.com/ec2/

  4. https://www.serverless.com/blog/

    https://www.serverless.com/blog/

Thanks for Lucidchart for the symbols.

感谢 Lucidchart 提供的符号。

普通英语JavaScript (JavaScript In Plain English)

Did you know that we have three publications and a YouTube channel? Find links to everything at plainenglish.io!

您知道我们有三个出版物和一个YouTube频道吗? 在plainenglish.io上找到所有内容的链接!

翻译自: https://medium.com/javascript-in-plain-english/essential-aws-services-a-full-stack-engineer-should-be-aware-of-5155f25ce7e3

aws技术栈

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值