Today I Learned & Did
- Deployment a Web App using AWS S3, EC2 and RDS
: With AWS, you get a place to store and serve your client-side files (S3), a virtual server that stays on as long as you need it to (EC2), and a full database management system in the cloud (RDS).
Basic deployment architecture using S3 (Client), EC2 (Server), RDS (Database).
: : S3 (React-Client) -> EC2 (Node-Server) -> RDS (MySQL-Database).
1. Amazon S3 (Simple Storage Service)
At its core, S3 is a service for storing any kind of data — literally anything. S3 buckets, which are containers for such data, provide automatic scaling (i.e., no fixed storage sizes). The files within these buckets can be delivered to clients at low latency levels, making S3 ideal for online services that require storage outside of a database environment.
All files in S3 are HTTP(s) enabled, which means that they can be accessed via URL. The public access configuration of these files can be set directly through an S3 bucket policy, allowing the bucket owner to control the identities that have access to the bucket.
S3 also allows static web hosting, which means client-side files (HTML, CSS, JS) can be served directly to a browser from an S3 bucket. If needed, such applications can easily be modified to make API calls to a virtual server, such as an EC2 instance.
2. Amazon EC2 (Elastic Compute Cloud)
Let’s say we set up a SPA using a static file hosting on S3. In order to make this application dynamic, it is also necessary to construct a back-end that can handle API requests from S3. This can be done through Amazon EC2, which allows for running virtual servers in the cloud.
EC2 provides users with computing environments — known as instances — based on operating systems like Linux, Ubuntu, Windows, etc. You can literally think of it as Amazon giving you one of the millions of computers it owns so that you can store and run your files on it.
Imagine that you’re getting one of these computers to run your EC2 server on. Source: Hipertextual
These instances can be accessed remotely via protocols like SSH and HTTP, allowing users to run server-side programs in these virtual environments for extended periods of time. It is also possible to create and manage databases (e.g., MySQL, PostgreSQL) within an EC2 instance’s local environment.
3. Amazon RDS (Relational Database Services)
Amazon RDS allocates users EC2 instances developed specifically for database management. These database instances can be based on any of the following six relational database engines: MySQL, MariaDB, PostgreSQL, Oracle, SQL Server, and Aurora. You can create and manage databases on these instances, just as you would on your local machine.
Naturally, many first-time users will ask: why use RDS and pay extra money when you can manually create databases on an EC2 instance? The answer is that RDS automates difficult database management tasks, potentially saving users a lot of time and money.
For example, you can easily change the CPU, storage, and IOPS of a database instance, thus enhancing scalability. The service also automates backups and recovery. Placing a database instance in a Virtual Private Cloud (VPC) — a virtual data center — also provides added security, as no entity other than a designated EC2 server(s) can access the database.
To conclude, here are the steps you should follow to deploy using AWS:
1. Upload your client-side files to an S3 bucket and enable static file hosting. Make sure your bucket permissions are set correctly — otherwise, your files will remain private.
2. Move your server-side programs to an EC2 instance and make sure that your client-side code makes API calls to this instance’s IP address.
3. Create a database instance in RDS and ensure that your server-side code references a database within this database instance.
Now start your server, and voilà! You now have a working web application.
하루 체크리스트
- 수면시간 지키기 : O
- 알고리즘 문제 풀이 : O
- 운동하기 : X
- 배운 내용 복습&정리 : O
- 새로운 내용 공부 (코스 외 공부) : O
'150일 안에 개발자 되기' 카테고리의 다른 글
200918 TILAD #D96 (0) | 2020.09.18 |
---|---|
200916 TILAD #D94 (0) | 2020.09.17 |
200913 TILAD #D91 (0) | 2020.09.13 |
200911 TILAD #D89 (0) | 2020.09.13 |
200909 TILAD #D87 (0) | 2020.09.09 |