DEV Community

Cover image for 6 Cloud Platforms You Should Be Using in 2020
Ernest Roy
Ernest Roy

Posted on • Edited on

6 Cloud Platforms You Should Be Using in 2020

A cloud platform is generally a turnkey solution that can make your life easier and take some of the complexity off your shoulders.

You probably can't build a complete and scalable application without using at least one cloud platform.

Here's the list:

1. Amazon Web Services

Even if you're not using it at your current job, you should at least get familiar with the EC2 and S3 components.

You don't need to sign up for an expensive course to learn the essentials.

Basic flows for EC2:

  1. Launch an instance
  2. Start/restart/stop an instance
  3. Create a backup
  4. Restore from a backup
  5. Configure Security Groups

Basic flows for S3:

  1. Create a bucket
  2. Create a folder
  3. Upload files
  4. Set permissions
  5. Download files

While you may want to use the UI to handle non-repetitive tasks in EC2, you're most likely going to use the AWS CLI to handle all the operations in S3.

Remember, AWS has a lot of components, almost anything you can think of in terms of cloud computing and APIs.

2. Twilio

Twilio is a cloud communication company that enables users to use standard web languages to build voice, VoIP, and SMS apps via a web API.

A functionality for sending text messages is not something you want to build from scratch.

Here is a Python example for sending an SMS with Twilio:

from twilio.rest import Client

account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

message = client.messages.create(
                              body='Hi there!',
                              from_='+15017122661',
                              to='+15558675310'
                          )

print(message.sid)
Enter fullscreen mode Exit fullscreen mode

You can read a short tutorial here.

3. SendGrid

SendGrid is a cloud-based email delivery platform, for both transactional and marketing emails.

Sure, you can send emails without SendGrid or any other external provider, all you need is a server.

It's as simple as:

<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);
?>
Enter fullscreen mode Exit fullscreen mode

But it's a bad idea to use your own email server instead of SendGrid.

Here's why:

  1. Your server might not be able to handle the volume of emails you're sending.
  2. The emails sent from your server might land in the Spam folder due to your low IP Reputation.
  3. You'll have to build your own tools to monitor the email activity.

SendGrid is not just for marketeers, it also provides a powerful Web API.

Here's a basic Python example for sending an email:

import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

message = Mail(
    from_email='from_email@example.com',
    to_emails='to@example.com',
    subject='Sending with SendGrid is Fun',
    html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
    sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
    response = sg.send(message)
    print(response.status_code)
    print(response.body)
    print(response.headers)
except Exception as e:
    print(e.message)
Enter fullscreen mode Exit fullscreen mode

As you can see, we also check the status code in this previous example.

4. Endtest

Endtest is a cloud platform where you can create and execute automated tests for your web applications and mobile applications

Offering your users a flawless experience is of paramount importance.

A good way to achieve that is to rely on automated tests and be the first one to find out when something stops working.

Unit tests and API requests are simply not enough to verify if your product is working as expected for your users.

Endtest offers an easy way to create functional automated tests and execute them on their cross-browser cloud and mobile device lab.

Endtest Execute Test

And you can do that without having to write a single line of code.

There is a recorder for Web Tests and a recorder for Mobile Tests, both rely on element identification, not on image recognition or OCR.

Endtest Mobile Recorder

It also offers an API and integrations with solutions such as Jenkins, Jira, Slack and others.
Endtest Results

Why should you use this cloud platform?

Here is a good answer.

5. Amplitude Analytics

This isn't your usual analytics solution where you import some JavaScript in your pages and it starts tracking the visitors.

Amplitude can help you track events from users and generate incredibly useful information.

For example, you can see how many of the users who signed up 6 weeks ago are still using your product, a metric which is known as retention.

Amplitude Retention

The catch is to use the event tracking capabilities and integrate them in your code.

For each action performed by a user, you can send a request to the Amplitude API to store an identifier for the user, the type of event and whatever else you need.

Here's how to send an event to Amplitude from your Python code:

import amplitude    

# initialize amplitude logger
amplitude_logger = amplitude.AmplitudeLogger(api_key = "SOME_API_KEY_STRING")

# example event
event_args = {"device_id":"somedeviceid", "event_type":"justtesting", 
              "event_properties":{"property1":"somevalue", "propertyN":"anothervalue"}
event = amplitude_logger.create_event(**event_args)

# send event to amplitude
amplitude_logger.log_event(event)
Enter fullscreen mode Exit fullscreen mode

This allows you to generate event timelines for all your users and segments.

6. Stripe

Stripe is a suite of payment APIs that powers commerce for online businesses of all sizes.

Handling payments is another thing you don't want to build from scratch.

Stripe is known for being developer-friendly and provides a detailed documentation for their APIs.

And having a stunning Checkout page can really increase those conversions.
Stripe Checkout

Handling payments is not just about processing a credit card payment, there are other important aspects covered by Stripe, such as fraud and compliance.

Here's an example using JavaScript:

var stripe = Stripe('_____YOUR_STRIPE_PUBLISHABLE_KEY___');
var elements = stripe.elements();

// Create an instance of the card Element
var card = elements.create('card', {style: style});
// Add an instance of the card Element into the `card-element` <div>
card.mount('#card-element');

// Handle real-time validation errors from the card Element.
card.addEventListener('change', function(event) {
    var displayError = document.getElementById('card-errors');
if (event.error) {
        displayError.textContent = event.error.message;
    } else {
        displayError.textContent = '';
    }
});

// Handle form submission
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
    event.preventDefault();
stripe.createToken(card).then(function(result) {
        if (result.error) {
            // Inform the user if there was an error
            var errorElement = document.getElementById('card-errors');
            errorElement.textContent = result.error.message;
        } else {
            stripeTokenHandler(result.token);
        }
    });
});

// Send Stripe Token to Server
function stripeTokenHandler(token) {
    // Insert the token ID into the form so it gets submitted to the server
    var form = document.getElementById('payment-form');
// Add Stripe Token to hidden input
    var hiddenInput = document.createElement('input');
    hiddenInput.setAttribute('type', 'hidden');
    hiddenInput.setAttribute('name', 'stripeToken');
    hiddenInput.setAttribute('value', token.id);
    form.appendChild(hiddenInput);
// Submit form
    form.submit();
}
Enter fullscreen mode Exit fullscreen mode

Top comments (4)

Collapse
 
claudem12448918 profile image
Claude Moore

Hi!
Also, I've learned a lot about the detailed analysis of the top three cloud platforms with a comparison chart and additional insights about google cloud vs aws vs azure pricing for building a strong case for cloud migration from this blog.
Share the link for u guys, need 2 know!

Collapse
 
samihk profile image
Abdul Sami Haroon

Nice article, FYI Firebase is also handy for many solutions.

Collapse
 
avoidspamuser profile image
avoidspamuser

SendGrid is unreliable. I got banned right after clicked "Submit" of the registration form. The support team refuses to unblock my account and stopped answering. This is ongoing for about 3 years. I regularly check them.

Collapse
 
ernestthecoder profile image
Ernest Roy

You should contact them on Twitter.
I've been using their service for over 2 years and it's been a good experience, minus the part where they charge us every month simply for storing a list of contacts on their platform, even if we don't send any emails.