on 14 Nov 2019 4:12 PM
  • Informática en la nube
  • AWS
  • Amazon Web Services
  • servicios web en la nube
  • servidores de AWS
  • servicios de AWS

Hello, in this article we will introduce you to Amazon Web Services, which is the world leader in cloud web services, surpassing Google and Microsoft.

We'll start the article with some definitions that will help you contextualize and understand what Amazon Web Services is.

Amazon Web Services, also known as AWS, provides a scalable infrastructure platform. In other words, it provides Information Technology (IT) infrastructure for enterprises in the form of web service (cloud computing). Thanks to this, companies such as Netflix, NASA, Expedia, Pinterest or the CIA no longer have to spend large amounts of money on servers and IT infrastructures as AWS guarantees a secure and reliable platform.

Amazon Web Services offers tools in the following categories:

● Cloud computing

● Databases

● Creation of virtual networks

● Business Applications

● Storage and content managers

● Business Intelligence (BI)

● Machine Learning

● Mobile Application Management

● Internet of Things

● Developer Tools

● Media Services

● Security and access control

● Video game servers

● Videogame development tools

Here's a little bit about the tools we've used:

DynamoDB

Have you ever played Clash of Clans? The Simpsons Tapout? Then you have indirectly used DynamoDB, which is a non-relational database server and can be used in parallel with relational servers or independently.

Its content is expressed in JSON (a widely known format), and its main characteristic is that, being non-relational, it does not have a static data structure, thus allowing greater versatility in relational databases. It is necessary to define the relations and the columns that the database is going to have, because each stored object is independent and does not have a defined structure.

For example, in relational databases, one must first define the structure, its tables and relationships, and any changes in the objects that are stored. Then, this static structure must be updated.

In non-relational databases, any amount of information can be sent in an object. This information is independent, but it can contain from 1 property (column, attribute) to N properties, since each object can have N-x properties.

It can be easily understood with this example:

object: {id: 1, playerName: “player 1”, score: “123”}

object: {id: 2, playerName: “player 1”, ipAddress: “127.0.0.1”, DOB: “1980-01-01”}

 

Both objects exist within the same context, but their content is different. You can imagine how they can be used in data analysis, medical information, government information, inventory applications, besides the ranking or status of characters in video games, etc..

Their use can be combined with relational databases, because as you may have noticed that objects stored in DynamoDB lack relationships with other objects. This means that all the flat information is stored inside the object, and a relational DB can be used to maintain consistency.

Examples of serverless applications using DynamoDB:

Alt

Source: aws.amazon.com

For more information, go to the following link: https://aws.amazon.com/es/dynamodb/

 

Chat applications for mobiles:

Alt

Source: aws.amazon.com

For more information, go to the following link: https://aws.amazon.com/es/dynamodb/

 

Data transmission for social media (social networks):

Alt

Source: aws.amazon.com

For more information, go to the following link: https://aws.amazon.com/es/dynamodb/

 

Other services in AWS

Kinesis Stream

What ideas come to mind when you need a constant flow of volatile information? If this information is not useful to you, why use it?

Well, AWS Kinesis stream has that characteristic. Imagine that it is like a pipeline where information flows, disordered, raw. This information is ordered in "shards" by a single partition key.

Imagine a traditional hard disk, where the information was stored in clusters or sectors. In the case of Kinesis, the information is stored in shards. Each shard contains one or several entities (objects) flowing into the stream, associated by a partition key that can usually be the object identifier.

This information has a limited lifetime; by default it disappears in 24 hours or whenever it has been correctly consumed. This information at some point must be used, and for that we have Lambda functions, which we will talk about shortly, which generate events that are often applications that must do something with that information.

Let's see a couple of real examples to better illustrate the use of Kinesis.

Photographs in a social network:

If you take a photo and upload it to a social network, for performance reasons, that photo should have several ways of being displayed: in small size for your cover or your photo list, in medium size for mobile devices and real size for a complete view. The photo you uploaded must be of considerable size (in terms of space it occupies) so no social network wants to upload a photo like this to your photo list (for example) because it would take time, consume a lot of bandwidth and would lose users. The ideal is to have these versions of photos already stored by the time that you upload your photo.

Imagine this: You upload the photo, and this photo is sent to Kinesis and flows until a Lambda function catches it. This Lambda function will call some code that someone made to take the photo, resize it for the different display options that the social network needs and will call a service, a database, a remote folder, etc., to save them. So, the next time you see your social network and upload a photo, the various display options will load immediately because, since you uploaded the first photo, they were already created (all that happens asynchronously but quite quickly).

Or what if you need to do data analysis? For example, you have a medical information application where you have a remote system that stores patient data and you want to do data analysis that takes into account the ages of patients, common health problems, location of patients with respect to their problems, prescriptions, number of visits and other valuable information for statistical analysis. What you do is to have some agent that constantly reads the remote system database and pushes new transactions (data changes) to Kinesis. Then your Lambda function triggers another application that discerns entities going through Kinesis, finds patients and sends them to a data-lake, API, Database, etc. so that later you can do your reports, analysis, etc. (Have you heard the term “analytics”? Well, there it is.)

There are many possibilities for Kinesis, and it is a way of moving data that is just beginning.

Lambda Functions (Applications without server)

These functions are rather like triggers or detonators that are activated when some events occur in the AWS universe.  These events can be Amazon S3 bucket (file container), a table in Amazon DynamoDB, Kinesis stream or SNS notifications (messaging system that notifies several applications in parallel).

Its uses? Well, many and varied! Let's think of the example of social networks using Kinesis. You upload a photo to your social network, and that photo passes through Kinesis, but the missing link in that workflow is Lambda. When an event occurs in Kinesis, it triggers one or several Lambda functions, each with a single responsibility to call an application previously developed, for example, an image resizer. These events are varied depending on the AWS service that generates them. In the case of Kinesis, it is a PUSH of information, in the case of DynamoDB, it is when a table was updated or a new entity edited/inserted, or in SNS it is that a message has been generated. Imagine that you are in an online game and a friend has entered the game. That's an event that can call one or more Lambda functions that in turn call one or more applications that do different things like notifying you that John Doe is logged in, or that NoobMaster69 has killed someone, or that Brittany has uploaded a new photo in her profile.

Lambda functions are always "listening" for these events and should be set to fire with one or the other of them, and also set to call the application they should.

If the application for some reason fails, it will return an exception to Lambda and Lambda will understand that as, "the destination of this information has failed, I will send the same thing again until everything goes well, or the information expires" then if something fatal happens (a down service, nonexistent database, entity not found, etc.) the most important thing is not to lose the information. So Lambda sends it again until it receives a positive result from the application OR the information expires (example: Kinesis stream keeps the data by default 24 hours).

 

in the case of DynamoDB, it is when a table was updated or a new entity edited/inserted, or in SNS it is that a message has been generated. Imagine that you are in an online game and a friend has entered the game. That's an event that can call one or more Lambda functions that in turn call one or more applications that do different things like notifying you that John Doe is logged in, or that NoobMaster69 has killed someone, or that Brittany has uploaded a new photo in her profile.

Lambda functions are always "listening" for these events and should be set to fire with one or the other of them, and also set to call the application they should.

If the application for some reason fails, it will return an exception to Lambda and Lambda will understand that as, "the destination of this information has failed, I will send the same thing again until everything goes well, or the information expires" then if something fatal happens (a down service, nonexistent database, entity not found, etc.) the most important thing is not to lose the information. So Lambda sends it again until it receives a positive result from the application OR the information expires (example: Kinesis stream keeps the data by default 24 hours).

 

Kinesis AWS UI:

Alt

Source: Lambda Management Site.

 

Example of Corporate Applications in AWS

Alt

Source: AssureSoft

In short, here is the flow: Agents living on a Microsoft SQL Database server (producers) constantly get information directly from the DB, this information is sent to Kinesis, which in turn makes it flow. Thus, a Lambda function attentive to this calls an external application, which in turn calls an API. The result? An integration between 2 completely different applications without having touched code in either. Is this not really incredible!

Prices of services in AWS

That's right, all this costs money, and this is an important section, since there are many companies that start in a very aggressive and optimistic way, hire services and plans that are too abundant for their use and end up in financial trouble. In summary, if you get excited with AWS without doing a study of your services, your data traffic, users, clients vs. AWS plans, then it can be complicated.

It's always a good idea to analyze, first, to see if you really need to use AWS (a hello world or a small store might not need paid AWS) and, second, to have an idea of the traffic your system will have.

The costs are high, but in the long run, you save a lot of time and work. Also, of course, AWS has its free layer for you to try their services (Moreover, you can create free accounts and have these services for free with clear limits.). I suggest you enter this nice world with clear ideas of what you want to understand or achieve. Through the free layer we can try many of the AWS services even for production environments for a year at no cost.

Greetings and good luck, earthling.