DEV Community

Cup of Code
Cup of Code

Posted on • Updated on • Originally published at cupofcode.blog

Introduction to AWS: Databases and other important services

This is the last blog post about services in AWS  — but definitely not the least!

cupofcode_blog_main_picture

Welcome to the fifth(!) blog post in the AWS series. I know, we’ve learned so much by now, it’s exhausting! But don’t worry — as I mentioned in the subtitle, this is the last blog post about the various services! The next one is going to be about billing and pricing, and the last one is about best practices in the cloud.

We can do it! Don’t give up hope!

cupofcode_blog_meme_beyonce

Today I’m going to introduce you to a bunch of services you need to know, at a basic level, in order to pass the AWS Certified Cloud Practitioner exam. Here is what we will talk about:

  • Networking: Route53, Global Accelerator, VPC, and Direct Connect
  • Databases: RDS, DynamoDB, RedShift, and Elasticache.
  • Management: Cloudwatch, CloudFormation, Systems Manager, Service Health Dashboard, and Personal Health Dashboard.
  • AI Services in AWS: Lex, Polly, Transcribe, and Rekognition.
  • Compute: Elastic Beanstalk and Lambda!

Shall we begin?

cupofcode_blog_learn


Networking: Route53, Global Accelerator, VPC, Direct Connect

Amazon Route 53

cupofcode_blog_1Route53

Route53 is Amazon’s DNS. What is DNS? Domain Name Server. Here is a cute explanation from AWS’s website:

All computers on the Internet find and communicate with one another by using numbers. These numbers are known as IP addresses. When you open a web browser and go to a website, you don’t have to remember and enter a long number. Instead, you can enter a domain name like cupofcode.blog and still end up in the right place.

DNS servers translate requests for names into IP addresses, controlling which server an end user will reach when they type a domain name into their web browser.

So, whenever you want to go to a website you give the address and get transferred to the right place. 

cupofcode_blog_meme_dns

Fun fact: Why is it called route 53? Because Route 66 is the first interstate highway across the US and DNS works on port 53.

Route 53 is a global service, just like IAM and S3. You can use route 53 to direct traffic from all around the world and also use it to register a domain name.

Route 53 is using S3 and therefore is serverless. Because it’s using S3, you should make sure there is an S3 bucket available with the same name you want to use as the domain name. (including the “.com”)


AWS Global Accelerator

cupofcode_blog_2GlobalAccelerator

AWS Global Accelerator is a service in which you create accelerators to improve the availability and performance of your applications for local and global users. You can also direct traffic to the optimal endpoint over the AWS global network.

How Does It Work? Global Accelerator sends your user’s traffic through AWS’s global network infrastructure, improving your internet user performance by up to 60%. When the internet is congested, Global Accelerators’s automatic routing optimizations will help keep your packet loss, jitter, and latency consistency low.


Amazon VPC and AWS Direct Connect

cupofcode_blog_3VPC_and_directConnect

AWS Direct Connect‘s purpose is pretty obvious from its name. It is a cloud service solution that makes it easy to establish a dedicated network connection from your premises to AWS. AWS Direct Connect is compatible with all AWS services accessible over the internet. This can increase bandwidth throughput and provide a more consistent network experience than internet-based connections.

Amazon VPC is a Virtual Private Cloud, and it lets you provision a logically isolated section of the AWS cloud where you can launch AWS resources in a virtual network you define: selection of your own IP address range, creation of subnets, and more. It is like a virtual data center in the cloud.

In your VPC you can create, for example, a public-facing network zone for your web servers that have access to the internet and place your backend systems (such as databases or application servers) in a private network zone with no internet access, which makes them more secure.

Connecting On-Premise to Your VPC

There are two ways to do so: VPN and Direct Connect

  • Connect using a VPN: You can create a hardware virtual private network (VPN) connection between your corporate data center and your VPC, leveraging the AWS cloud as an extension of your corporate data center.
  • Connect using Direct Connect: Using AWS Direct Connect, you can establish private connectivity between AWS and your data center, office, or colocation environment, which (in many cases) can reduce your network costs, increase bandwidth throughput and provide a more consistent network experience than internet-based connections.
  • Connect using VPN over Direct Connect: For the ultimate security, you can use a VPN over Direct Connect. This means that not only do you have a dedicated line into AWS but also that all your traffic to and from AWS is encrypted over the Direct Connect connection using a VPN.

We finished the networking section! We deserve a meme break!

cupofcode_blog_meme_VPN


Databases in AWS

A database is an organized collection of structured information. There are two types of DBs, relational and non-relational, and AWS covers both: The relational DB is called RDS (Relational Database Service), and the non-relational DB is called DynamoDB.

Amazon RDS

cupofcode_blog_4RDS

Let’s start by talking about Relational DBs. Visually, they look similar to excel sheets: tables, rows, columns, fields. You interact with your DB using SQL = Structured Query Language.

In relational DB, when you add columns it would affect the rest of the rows. For example, if we have a class of students and we keep their details in a DB table, we will have columns like First name, Last name, and Phone number. If one day we get a new student in class with a middle name and decide to add a column for that, this field will appear for all kids. 

Before adding the student:

FIRST_NAME | LAST_NAME | NUMBER |
Gal        | Gadot     | +353.. |
Enter fullscreen mode Exit fullscreen mode

After adding the student:

FIRST_NAME | MIDDLE_NAME | LAST_NAME | NUMBER |
Gal        | N/A         | Gadot     | +353.. |
Taylor     | Alison      | Swift     | +353.. |
Enter fullscreen mode Exit fullscreen mode

You can see more examples here.

cupofcode_blog_taylor

Now, back to RDS:

  • Using RDS, you can choose between 6 different DB services: SQL Server by Microsoft, Oracle, MySQL server, PostgreSQL, Amazon Aurora, and MariaDB.
  • RDS has 2 key features: Multi-AZ and Read replicas.

Multi-AZ for disaster recovery

An EC2 instance connects through a connection string to our RDS DB and Amazon automatically points this connection string to your primary DB. In the event that you will lose your primary DB, Amazon will automatically fail the connection over to your secondary DB in another AZ. To clarify, you don’t need to go and change anything —  it detects the event and changes automatically.

Read replicas for high performance

Having read replicas means that your EC2 instance is writing to your primary DB and those entries are replicated to the secondary DBs. You can have up to 5 copies of your primary DB!

Don’t get confused. If you were to lose your primary DB, there is no automatic failover to your read replica. Your system is just going to go down because your EC2 instances won’t be able to write to your primary DB.

So what are read replicas useful for? You can set it up so that your EC2 instances do all their writes to your primary DB and then do all their reads from their read replicas. This increases performance because you now got all your EC2 instances doing all their reads from 5 different copies of the DB.


Amazon DynamoDB

cupofcode_blog_5DynamoDB

Let’s start by explaining what is a non-relational DB. Non-relational DB is breaking the structure a bit. In this case, we have:

  • Collection — which is similar to a table
  • Document — which is similar to a row (=entry)
  • Key-value pairs — which is similar to fields

How does it look? With the students' example from before, it will look something like this:

{
  FIRST_NAME: Gal,
  LAST_NAME: Gadot,
  NUMBER: +353..
},
{
  FIRST_NAME: Taylor, 
  MIDDLE_NAME: Alison,
  LAST_NAME: Swift,
  NUMBER: +353..
}
Enter fullscreen mode Exit fullscreen mode

The difference is that here we use JSON/NoSQL. That means that:

  • The columns in the table can vary
  • This will not affect other rows in the DB

So, now that we covered that — Let’s look at the definition of the service from the official AWS website:

Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale. It’s a fully managed, multi-region, multi-active, durable database with built-in security, backup and restore, and in-memory caching for internet-scale applications. DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.


Amazon Redshift

cupofcode_blog_6RedShift

When I create the image above, I thought to myself: “Wait a minute… RedShift is under Analytics, what does it do in the DB section?”. Apparently, Redshift is Amazon’s analytics database. RedShift is designed to crunch large amounts of data as a data warehouse.

Database vs Data Warehouse: A database is a collection of related data that represents some elements of the real world whereas a Data warehouse is an information system that stores historical and commutative data from single or multiple sources. The database is designed to record data whereas the Data warehouse is designed to analyze data.

Now, I don’t know if the next part is necessary for the exam, but better safe than sorry: OLTP vs OLAP. They differ in terms of the types of queries you will run. OLTP (On*Line **Transaction **Processing) pulls the entire row as RDS does, and OLAP (OnLine **Analytic **P*rocessing) pulls in large numbers of records as RedShift does.

Amazon Elasticache

cupofcode_blog_7Elasticache

Elasticache is a web service that makes it easy to deploy, operate, and scale an in-memory cache in the cloud. The service improves the performance of web applications by allowing you to retrieve information from fast managed in-memory caches, instead of relying entirely on slower disk-based DBs.

Elasticache supports two open-source in-memory caching engines: Memcached and Redis.


To Summarize

  • RDS (SQL/OLTP): 6 options for engines, Multi-AZ and Read replicas.
  • DynamoDB(NoSQL): a key-value and document database.
  • RedShift (OLAP): Used for business intelligence or Data Warehousing.
  • Elasticache: Uses Memcached and Redis to speed up the performance of existing DBs (frequent identical queries).

Finished with DBs! It’s time for our meme:

cupofcode_blog_meme_DBs


Management: CloudWatch, CloudFormation, Systems Manager, Health dashboards

Amazon CloudWatch

cupofcode_blog_8CloudWatch

Amazon CloudWatch is a service that monitors your AWS resources, as well as the apps that you run on AWS. By monitoring I mean you can see metrics, dashboards, log streams, and alarms.

CloudWatch will monitor events every 5 min by default, but you can have 1-minute intervals by turning on detailed monitoring.

CloudWatch can monitor things like:

  • Compute: EC2 instances, ASGs, ELBs, and Route 53 health checks.
  • Storage and content delivery: EBS volumes, AWS Storage Gateway, and CloudFront.
  • Underlying physical host: Host level metrics consist of: CPU, Network, Disk, Status check.

A tip for the exam: “Billing alarm!” is the answer to the question “how can you get an automatic notification if your account goes over 1000 dollars?”. The billing alarm lets you set a threshold you are willing to pay and AWS will alarm you when you exceed that amount for the month. You can find it in AWS console -> CloudWatch -> Billing -> Create Alarm.


CloudFormation

cupofcode_blog_9CloudFormation

AWS CloudFormation turns infrastructure into code. It is a service that helps you model and set up your AWS resources so that you can spend less time managing those resources and more time focusing on your apps that run in AWS.

How does this magic happen? You create a template that describes all the AWS resources that you want (EC2 instances, RDS instances), and CloudFormation takes care of provisioning and configuring those resources for you.

You don’t need to individually create and configure AWS resources and figure out what’s dependent on what; CloudFormation handles all of that.


AWS Systems Manager

cupofcode_blog_10SystemManager

AWS Systems Manager allows you to manage your resources at scale. What does it mean? Let’s say you have an EC2 fleet, and you want to modify something. Should you update 30 instances manually? Ew, of course not. You can run a command to all of them at the same time.

With AWS Systems Manager, you can manage servers running on AWS and in your on-premises data center through a single interface. You can also automate operational tasks for Amazon EC2 instances or Amazon RDS instances.

How does it work? A piece of software is installed on each VM. Here is a diagram from the official AWS website: 

cupofcode_blog_11SystemManager2


Health Dashboards: Service vs Personal

cupofcode_blog_12HealthDashboards

Service Health Dashboard: 

A public website (https://status.aws.amazon.com/) that gives you an overview of all regions: This shows all regions and the health of all AWS services in those regions. You can also review all historical information for each AWS service on a per-day basis.

Lastly, it wouldn’t be a proper dashboard without notifications, right? Service Health Dashboard provides RSS feeds, which you can subscribe to and get immediate notifications if a specific service in a particular region goes down.

Personal Health Dashboard:

AWS Personal Health Dashboard provides alerts and remediation guidance when AWS is experiencing events that may impact you. You can also set up alerts for events that might affect your AWS infrastructure.

cupofcode_blog_13HealthDashboards2

What is the difference?

While the Service Health Dashboard displays the general status of AWS services, Personal Health Dashboard gives you a personalized view into the performance and availability of the AWS services underlying your AWS resources.


Now that we finished the management section, it’s time for a meme break!

cupofcode_blog_meme_monitoring


AI Services — Lex, Polly, Transcribe and Rekognition

There are more, but according to my research, we only need to know these 4.

cupofcode_blog_14AiServices

Amazon Lex — The power behind Amazon’s Alexa.

This is a service that allows you to build conversational chatbots. These can be powered either via voice or text.

Amazon Polly — Converts text to a life-like voice.

You can choose between different languages, male or female voices, and even the accent you would like the voice to be rendered in.

Amazon Transcribe — Converts speech into text.

Great for generating subtitles or for getting transcripts of interviews, speeches, etc.

  • Notice that Polly and Transcribe are providing opposite services.

Amazon Rekognition — Provides a way of converting images into tags/text.

You upload a picture and Rekognition tells you what it thinks the image is with a certain degree of confidence.

  • Notice that Transcribe and Rekognition provide complementing services.

cupofcode_blog_meme_alexa


Compute: Elastic Beanstalk and Lambda

AWS Lambda

cupofcode_blog_15Lambda

AWS Lambda is a compute service where you can upload your code and create a Lambda function. Lambda is serverless and scales out (not up!) automatically. Also, you can have multiple versions of your code inside Lambda.

Lambda is an event-driven compute service that can run your code in response to events. Lambda functions are independent (1 event = 1 function). These events could be changes to data in an S3 bucket or a DynamoDB table.

Supported languages: Node.js, Java, Python, C#, Go, PowerShell

How is Lambda priced?

  1. The number of requests: First 1 million requests (per month) are free and 0.20$ per 1 million requests thereafter.
  2. Duration: Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 100ms. The price depends on the amount of memory you allocate to your function. You are charged $0.00001667 for every GB-second used.

Version control: You can use version control with Lambda to have multiple versions of your code. You can also roll back your code at any time, restoring previous versions.

The Shared Responsibility Model: You are responsible for your code and what version of the programming language is running.

Amazon is responsible for all hardware, operating systems, and security patching of the entire software stack as well as antivirus.

To conclude, Lambda is serverless, event-driven, has automatic continuous scaling and is super cheap. It has version control and a shared responsibility model.

Just for fun, here are examples for AWS Services that we learned in the series and invoke Lambda functions synchronously:

  • Elastic Load Balancer
  • Amazon Lex
  • Amazon CloudFront

AWS Elastic Beanstalk

cupofcode_blog_16ElasticBeanstalk

AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services. It’s called like that because a beanstalk grows quickly.

With Elastic Beanstalk you can provision your EC2 instances, your SGs, your ALBs, and other resources, with the click of a button. It automates everything for you, which leaves you only taking care of the code.

To clarify, that means you can quickly deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs those apps. You simply upload your app, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and app health monitoring. Pretty cool, ah?

Elastic Beanstalk vs CloudFormation

  • Elastic Beanstalk and CloudFormation are both FREE services but the resources they provide, such as EC2 instances, aren’t free.
  • Elastic Beanstalk is a way to deploy AWS resources. Cloudformation will take us one step further. Elastic beanstalk is limited in what it can provide and is not programmable. CloudFormation can provision almost any AWS service and is completely programmable.

That’s it for today!

cupofcode_blog_meme_simple

Do you know how many services we learned today? 19! Let’s play a game, I’ll tell you how many were in every category, and you check if you remember the names:

  • Networking: 4, and that section ended with the Homer Simpson meme, remember?
  • Databases: 4, and here is a hint: relational/non-relational DB, and two more ;)
  • Management: 5, and technically one of them is a public website, not a service in AWS console.
  • AI Services in AWS: 4, and that’s a tough one because this section was short and sweet, not very memorable.
  • Compute: 2, and those are the last ones you saw, they should be fresh in your memory!

If you read this, you’ve reached the end of the blog post, and I would love to hear your thoughts! Was I helpful? Do you also use AWS at work? Here are the ways to contact me:

Facebook: https://www.facebook.com/cupofcode.blog/

Instagram: https://www.instagram.com/cupofcode.blog/

Email: cupofcode.blog@gmail.com

[https://cupofcode.blog/](https://cupofcode.blog/)

Top comments (0)