DEV Community

Michael Levan
Michael Levan

Posted on • Originally published at clouddev.engineering

Developing for the Cloud

When you think about development, whether you're seeing people talking about code on Twitter, Reddit, blog posts, or any other location, chances are it's about creating an application of sorts. Whether that's a frontend, a website, or some backend API. Very little do you see development and programming topics based purely on using development to get a job done.

What do I mean by get a job done? It could be a few different actions:

  • The creation of a resource in Azure.
  • Creating a Lambda service in AWS.
  • Using a programming language to build a wrapper around an existing API.
  • Infrastructure development with a programming language. For example, creating a Kubernetes cluster with Golang.
  • Interacting with a SaaS based application.

The list can go on for pages and pages. The point is, development and programming isn't just for building the next big app. You can use the same exact practices that any developer uses for developing your cloud world.

Finding an SDK

The first thing you'll want to do is find out if the cloud provider you're using has an SDK for the programming language you want to use. 9 times out of 10, there's some sort of SDK for the popular languages like:

  • Python
  • C#
  • Go
  • PowerShell
  • JavaScript
  • Java

Depending on the cloud provider you're using, there may be more than others.

To find an SDK, it'll be pretty simple. Open up a web browser, go to Google, and search for the SDK. The screenshot below shows searching for a Go SDK on Azure. The first two links you'll see is for GitHub. The first link is for the SDK itself and the second link is for examples.

https://www.clouddev.engineering/content/images/2020/09/image.png

Depending on how comfortable you are with a language, it's recommended to simply jump into the SDK and see what appears to be happening.

If you click on the first link from the above screenshot, you'll see a screenshot similar to the one below with an SDK directory.

https://www.clouddev.engineering/content/images/2020/09/image-1.png

If you click on the SDK directory, you'll see all of the ways you can interact with Azure using Go.

The approach above was for Azure and Go, but you can use the same approach when you're searching for any SDK.

Interacting with APIs

Once you find an SDK and get familiar with the way it works, it's time to interact with it. What all SDKs do is make API calls to the platform (Azure, AWS, etc.). Because of that, there are some steps to take to interact with the API.

Authentication

The first is going to be authentication. Depending on the SDK, there could be one way to authenticate or many. Let's take EC2 and S3 for example. Since they are different APIs, there could be one way to interact with EC2 and another way to interact with S3. There could also be a way to use aws credentials that you perhaps have as a local profile that you can use for authentication.

Another example is virtual machines and storage accounts in Azure. With virtual machines, you may only simply need an IAM account an an Azure Active Directory account. However, with storage accounts, you might need to use the specific key or the connection string to interact with the storage account.

The point is, there are going to be a ton of different authentication methods and chances are there isn't always to be a one size fits all approach.

Classes and Methods

When you're working with an SDK, there will be different classes and methods available for API calls for all services. For example, there will be different classes and methods in AWS for:

  • EC2
  • S3
  • RDS
  • Lambda

You get the drift, there are a lot. Because of this, a great thing to do is look at GitHub and check out the actual code that's being used.

An example in the screenshot below shows the code that contains the Python method for the AWS SDK that allows you to create tags.

https://www.clouddev.engineering/content/images/2020/09/image-2.png

Writing Your Own Implementation

An alternative for if you don't like the SDK, or it's missing some implementation that you want to use, is add your own.

A few ways you can do that is:

  • Contribute to the open source project on GitHub.
  • Create your own wrapper around the API.

When you create your own, you have the ability to do exactly what you want to do. However, when you contribute to the open source project, it allows you to not have to reinvent the wheel, AKA, there's probably a ton of code in the already-created open source project that you'll end of having to write anyways.

Conclusion

Cloud development is fun and definitely essential in today's world. There's no reason to not automate the workflows that you would usually do in the UI of a console. It makes the process repeatable, dependable, and fun.

Top comments (0)