接口样板_完整的AWS Web样板

接口样板

by Kangze Huang

黄康泽

完整的AWS Web样板 (The Complete AWS Web Boilerplate)

通过利用Amazon Cloud构建功能强大的可扩展Web应用程序 (Build powerful scalable web apps by leveraging Amazon Cloud)

目录 (Table of Contents)

Part 0: Introduction to the Complete AWS Web Boilerplate

第0部分: 完整的AWS Web Boilerplate简介

Part 1: User Authentication with AWS Cognito (3 parts)

第1部分: 使用AWS Cognito进行用户身份验证 (3部分)

Part 2: Saving File Storage Costs with Amazon S3 (1 part)

第2部分: 使用Amazon S3节省文件存储成本 (第1部分)

Part 3: Sending Emails with Amazon SES (1 part)

第3部分: 使用Amazon SES发送电子邮件 (第1部分)

Part 4: Manage Users and Permissions with AWS IAM [Coming Soon]

第4部分:使用AWS IAM管理用户和权限[即将推出]

Part 5: Cloud Server Hosting with AWS EC2 and ELB[Coming Soon]

第5部分:使用AWS EC2和ELB托管云服务器[即将推出]

Part 6: The MongoDB Killer: AWS DynamoDB [Coming Soon]

第6部分:MongoDB杀手:: AWS DynamoDB [即将推出]

Part 7: Painless SQL Scaling using AWS RDS [Coming Soon]

第7部分:使用AWS RDS进行无痛SQL扩展[即将推出]

Part 8: Serverless Architecture with Amazon Lambda [Coming Soon]

第8部分:使用Amazon Lambda的无服务器架构[即将推出]

你好2017 (Hello 2017)

You want to build scalable production-ready apps but don’t have the resources to hire a multi-person team to manage all the code necessary for the big leagues. You’ve heard about 2 person wonder-teams that create fantastically efficient apps on a fraction of the thousand dollar budgets of traditional teams. Your wallet would love you if you could pay for just the services you need, without any of the fixed overhead costs. So you do your research and arrive at Amazon Web Services, the world’s largest and most comprehensive cloud services provider. But after an hour after investigating, you are overwhelmed by the sheer size and variety of solutions available. “Damn”, you say, “where do I even begin?”

您想构建可扩展的生产就绪型应用程序,但没有资源聘请多人团队来管理大型联赛所需的所有代码。 您已经听说过2个人组成的神奇团队,他们以传统团队数千美元预算的一小部分创建了效率极高的应用程序。 如果您只需支付所需服务的费用,而没有任何固定管理费用,那么您的钱包就会爱您。 因此,您需要进行研究,然后到达全球最大,最全面的云服务提供商Amazon Web Services。 但是经过一小时的调查,您对于庞大的规模和可用的各种解决方案感到不知所措。 您说:“该死,我什至从哪里开始?”

If you’ve ever looked into the documentation on AWS and tried to wrap your head around how all the pieces connect together, you’ll know that it’s no easy task. When you try to implement something simple like S3, you’ll wander into IAM for security and from there potentially stumble into AWS STS, AWS Cognito… the list goes on. How about EC2? Security Groups? AWS Lambda? It’s just one rabbit hole after another.

如果您曾经研究过AWS上的文档,并试图将所有部分联系在一起,那么这将不是一件容易的事。 当您尝试实现诸如S3之类的简单内容时,您会涉足IAM以获得安全性,然后可能会涉足到AWS STS,AWS Cognito等中。 EC2呢? 安全组? AWS Lambda? 只是一个又一个兔子洞。

Now you don’t necessarily have to use Amazon for everything. If you already know how to integrate user authentication using an existing means, then that’s probably your best option. No need to add extra complexity. But how about scaling databases? Ok sure, maybe you don’t need to scale YET, so no problem. But are you managing your app secrets securely? Are you saving server bandwidth by hosting your large files elsewhere on the cloud? Maybe you as a business would benefit from collecting lots of user data, but you’re not sure if your main database could handle the extra load. There’s so many things you COULD do to grow your product, but DON’T do because it’s just too much work.

现在,您不必一定要使用Amazon进行所有操作。 如果您已经知道如何使用现有方法集成用户身份验证,那么这可能是您的最佳选择。 无需增加额外的复杂性。 但是如何扩展数据库呢? 好的,也许您不需要扩展YET,所以没问题。 但是,您是否在安全地管理应用程序的机密? 您是否通过在云中的其他位置托管大型文件来节省服务器带宽? 也许您作为一家企业会从收集大量用户数据中受益,但是您不确定主数据库是否可以处理额外的负载。 您可以做很多事情来发展您的产品,但不要这样做,因为这工作太多了。

Introducing Kangzeroo’s Complete AWS Web Boilerplate — A starter app that fully integrates Amazon into every tedious infrastructure task and scales automatically. By leveraging AWS in your apps from the very beginning, your business can hit the ground running and focus your precious resources on refining your product. This is truly a modern stack that will let you wield the power of an entire team of developers at a fraction of the cost and time. We won’t be covering every single Amazon service, just the core ones you will likely use. If you’re excited and ready to get started, continue reading. Although this is an advanced tutorial series, don’t be scared to follow along, even if you aren’t coding — the knowledge is invaluable. So let’s begin!

Kangzeroo的完整AWS Web Boilerplate简介—一个入门应用程序,可将Amazon完全集成到每个繁琐的基础架构任务中并自动扩展。 通过从一开始就在您的应用程序中利用AWS,您的企业可以开始运作,并将宝贵的资源集中在完善产品上。 这是真正的现代化堆栈,使您可以以一小部分的成本和时间来利用整个开发团队的力量。 我们不会涵盖每一项亚马逊服务,而仅涵盖您可能会使用的核心服务。 如果您很兴奋并且准备开始,请继续阅读。 尽管这是一个高级教程系列,但是即使您没有编写代码,也不要害怕继续学习-这些知识是无价的。 让我们开始吧!

AWS基础架构概述 (A Overview of the AWS Infrastructure)

The previous screenshot of all AWS services was super intimidating. To be honest, I was just trying to scare you. These are the 8 services we will actually be using. Let’s go over each service and what it’s used for, as well as the potential free tier options. In order to use AWS, you must sign up for an account which requires a credit card. The good news is that you won’t necessarily have to pay, as every new AWS account gets free usage tier for one year.

之前所有AWS服务的屏幕截图都令人生畏。 老实说,我只是想吓you你。 这些是我们将实际使用的8个服务。 让我们研究一下每种服务及其用途以及潜在的免费套餐选项。 为了使用AWS,您必须注册一个需要信用卡的账户。 好消息是,您不必一定要付费,因为每个新的AWS账户都会获得一年的免费使用套餐。

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

Amazon IAM is used for managing permissions throughout your Amazon account. One Amazon account may have several users, such as one for deploying apps and another for purely analyzing data. Since you do not want the analyst to be able to modify anything, we need a separate “account” for the analyst. We can use IAM to create and manage that separate “account” (via IAM users or roles) and contain our paranoia. Thank heavens! IAM can also be used to grant specific permissions to certain services, such as an IAM role specifically for sending emails or accessing an S3 bucket. IAM is completely free.

Amazon IAM用于管理整个Amazon帐户的权限。 一个Amazon帐户可能有多个用户,例如一个用于部署应用程序,另一个用于纯粹分析数据。 由于您不希望分析师能够修改任何内容,因此我们需要为分析师提供一个单独的“帐户”。 我们可以使用IAM创建和管理该单独的“帐户”(通过IAM用户或角色)并包含我们的偏执狂。 谢天谢地! IAM还可以用于为某些服务授予特定权限,例如专门用于发送电子邮件或访问S3存储桶的IAM角色。 IAM是完全免费的。

弹性云计算(EC2) (Elastic Cloud Compute (EC2))

Amazon EC2 is used for hosting your apps on virtual cloud servers. It is the most commonly used Amazon service and probably the cheapest and most reliable cloud hosting you can get. You may have heard of EC2 competitors such as DigitalOcean, Linode and A Small Orange which seem very user friendly. It’s true they are very user friendly, but why not stay within the Amazon ecosystem? Keep everything in Amazon and you don’t have to learn multiple different systems. The best part is, the free tier is very generous! You can keep your server running 24/7 and still be within the free tier limits.

Amazon EC2用于在虚拟云服务器上托管您的应用程序。 它是最常用的Amazon服务,可能是您可以获得的最便宜,最可靠的云托管。 您可能听说过EC2竞争对手,例如DigitalOcean,Linode和A Small Orange,它们看起来非常用户友好。 的确,它们非常用户友好,但为什么不留在Amazon生态系统中呢? 将所有内容保存在亚马逊中,您无需学习多个不同的系统。 最好的部分是,免费套餐非常慷慨! 您可以使服务器保持24/7全天候运行,并且仍处于免费套餐限制之内。

认知 (Cognito)

AWS Cognito is a user authentication and management service. With Cognito, you do not need to keep track of secret keys used for hashing passwords nor implement hardcore security. It’s all handled by Amazon, and you even get advanced features such as two-factor authentication and “forgot my password” functionality. Using Cognito also makes it really easy to restrict public access to other AWS services, such as S3, by associating an IAM role with a Cognito login and giving access permission to only that role. Cognito is very generous, with up to 50,000 free active monthly users even after the free tier expires.

AWS Cognito是用户身份验证和管理服务。 使用Cognito,您无需跟踪用于散列密码的秘密密钥,也无需实施核心安全性。 这一切都由Amazon处理,您甚至可以获得高级功能,例如两因素身份验证和“忘记密码”功能。 通过将IAM角色与Cognito登录名相关联并仅授予对该角色的访问权限,使用Cognito还可非常轻松地限制对其他AWS服务(例如S3)的公共访问。 Cognito非常慷慨,即使免费套餐到期后,每月仍有多达50,000个免费活跃用户。

简单可扩展存储(S3) (Simple Scalable Storage (S3))

AWS S3 is cloud file storage. It is a very popular Amazon service that allows us to store any type of file of any size on a file system that is separate from our servers. From a performance standpoint this is great because servers don’t need to waste computing power and bandwidth on transferring files. From a financial standpoint, S3 is also a bargin because S3 bandwidth/storage is a lot cheaper than EC2 bandwidth/storage. Instead of sending an image file, you send a url string and your app client fetches the image from S3. Amazon S3 also has a free tier, but even without it it’s ridiculously cheap. To store 10GB of images with 30GB data transfer-out and 1 million GET requests comes out to a monthly total of… $1.89 USD.

AWS S3是云文件存储。 这是一项非常受欢迎的Amazon服务,它使我们能够在与服务器分开的文件系统上存储任何大小的任何类型的文件。 从性能的角度来看,这很好,因为服务器不需要在传输文件时浪费计算能力和带宽。 从财务角度来看,S3也是便宜货,因为S3带宽/存储比EC2带宽/存储便宜很多。 您无需发送图像文件,而是发送url字符串,然后您的应用客户端会从S3获取图像。 Amazon S3也有免费套餐,但即使没有免费套餐,也是如此便宜。 要存储10GB的图像以及30GB的数据输出和100万个GET请求,每月的总费用为1.89美元。

关系数据库服务(RDS) (Relational Database Service (RDS))

AWS RDS (what a mouthful) is a cloud managed relational database service. Although Amazon offers its own proprietary relational database, called Amazon Aurora, you can choose to use a variety of existing well known databases. Options include MySQL, PostgreSQL, Oracle and Microsoft SQL Server. The great thing about RDS is that it auto-scales for you, saving you expensive labor/expertise hours.

AWS RDS(令人mouth舌)是一种云托管的关系数据库服务。 尽管Amazon提供了自己的专有关系数据库,称为Amazon Aurora,但是您可以选择使用各种现有的知名数据库。 选项包括MySQL,PostgreSQL,Oracle和Microsoft SQL Server。 RDS的优点在于,它可以为您自动缩放,从而节省了昂贵的人工/专业时间。

DynamoDB (DynamoDB)

AWS DynamoDB is a proprietary noSQL database managed and auto-scaled by Amazon. It is great for storing your misc unstructured data, or as an “approximate alternative” to AWS Redshift if you can’t afford it. DynamoDB has really matured over the years. A few years ago it was only a key-value store (as in no nested objects or arrays), but today it is extremely flexible. You can nest objects up to 16 layers deep and query on multiple indexes. That also makes it an “approximate alternative” to MongoDB, granted that you have your own data structure checking in place. The best part is that the 25GB of free storage does not expire after your free trial!

AWS DynamoDB是由Amazon管理和自动扩展的专有noSQL数据库。 它非常适合存储杂乱的非结构化数据,或者在您负担不起的情况下作为AWS Redshift的“近似替代品”。 多年来,DynamoDB确实已经成熟。 几年前,它只是一个键值存储(因为没有嵌套对象或数组),但是今天它非常灵活。 您可以嵌套多达16层的对象,并在多个索引上进行查询。 这也使其成为MongoDB的“近似替代品”,前提是您已检查自己的数据结构。 最好的部分是,免费试用后25GB的免费存储空间不会过期!

简单电子邮件服务(SES) (Simple Email Service (SES))

Why bother setting up your own email server when you can use AWS SES? If your product uses emails for sending receipts, newsletters or as a log of activity, you can use SES to affordably manage those communications. Email sending is a pretty standard cloud service, and you could go with providers such as MailChimp and SendGrid, but again, being contained in the Amazon ecosystem has many benefits! While MailChimp gives you 12,000 free emails a month, AWS SES gives you 62,000. That’s economies of scale for you!

当您可以使用AWS SES时为何还要设置自己的电子邮件服务器? 如果您的产品使用电子邮件发送收据,新闻通讯或作为活动日志,则可以使用SES负担得起地管理这些通信。 电子邮件发送是一种非常标准的云服务,您可以与MailChimp和SendGrid等提供商一起使用,但是再次包含在Amazon生态系统中有很多好处! MailChimp每月为您提供12,000封免费电子邮件,而AWS SES则为您提供62,000封电子邮件。 这就是您的规模经济!

拉姆达 (Lambda)

AWS Lambda is a very unique service offered by Amazon. One of the major benefits of staying in the Amazon ecosystem is that you can use AWS Lambda to trigger events or actions from one service to another without running your own server. An example is if you wanted to create a user folder in your S3 bucket every time a user signs up. Or maybe you want to trigger an email if someone deletes certain content from your database. Or maybe you want to set up data pipelines to stream your user data to be processed and routed in real time. The possibilities are flexible and endless! AWS Lambda is also free after your trial period ends.

AWS Lambda是亚马逊提供的一项非常独特的服务。 停留在Amazon生态系统中的主要好处之一是,您可以使用AWS Lambda触发事件或从一项服务到另一项服务的操作,而无需运行自己的服务器。 例如,如果您想在每次用户注册时在S3存储桶中创建一个用户文件夹。 或者,如果有人从您的数据库中删除某些内容,您可能想触发一封电子邮件。 或者,也许您想建立数据管道以流处理要实时处理和路由的用户数据。 可能性是无限的! 试用期结束后,AWS Lambda也免费。

结论 (Conclusion)

After seeing that high level overview of the Amazon services we will be using, you’re probably really hyped. That’s great because I believe you should love the technology you are using. Amazon is both powerful and affordable, allowing you to be a 10x developer (accomplishes the work of 10 other programmers) in mind and practice. Do you feel the power running through your veins? Are you excited to learn this stack? Are you ready to scale from Day 1? If so, let’s get started.

在看到我们将要使用的Amazon服务的高层次概述之后,您可能真的被炒作了。 太好了,因为我相信您应该喜欢您所使用的技术。 亚马逊功能强大且价格适中,使您可以在思维和实践上成为10倍的开发人员(完成其他10位程序员的工作)。 您是否感觉到力量流过您的血管? 您对学习此堆栈感到兴奋吗? 您准备从第一天开始进行扩展吗? 如果是这样,让我们​​开始吧。

目录 (Table of Contents)

Part 0: Introduction to the Complete AWS Web Boilerplate

第0部分: 完整的AWS Web Boilerplate简介

Part 1: User Authentication with AWS Cognito (3 parts)

第1部分: 使用AWS Cognito进行用户身份验证 (3部分)

Part 2: Saving File Storage Costs with Amazon S3 (1 part)

第2部分: 使用Amazon S3节省文件存储成本 (第1部分)

Part 3: Sending Emails with Amazon SES (1 part)

第3部分: 使用Amazon SES发送电子邮件 (第1部分)

Part 4: Manage Users and Permissions with AWS IAM [Coming Soon]

第4部分:使用AWS IAM管理用户和权限[即将推出]

Part 5: Cloud Server Hosting with AWS EC2 and ELB[Coming Soon]

第5部分:使用AWS EC2和ELB托管云服务器[即将推出]

Part 6: The MongoDB Killer: AWS DynamoDB [Coming Soon]

第6部分:MongoDB杀手:: AWS DynamoDB [即将推出]

Part 7: Painless SQL Scaling using AWS RDS [Coming Soon]

第7部分:使用AWS RDS进行无痛SQL扩展[即将推出]

Part 8: Serverless Architecture with Amazon Lambda [Coming Soon]

第8部分:使用Amazon Lambda的无服务器架构[即将推出]

These methods were partially used in the deployment of renthero.ca

这些方法部分地用于了renthero.ca的部署中

翻译自: https://www.freecodecamp.org/news/the-complete-aws-web-boilerplate-d0ca89d1691f/

接口样板

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值