AWS CLI and SDKs

Natasha Ong
This is some text inside of a div block.
4 min read

In a nutshell:

The AWS Management Console, the CLI, and the SDKs are all ways to provision and manage your AWS environment.
The AWS Management Console is what we've been using for practical exercises. It's great for beginners and is the most visual options. It's a manual tool, so it isn't a great option for automation.
Infrastructure as Code (IaC) means creating and managing your entire infrastructure using code.
You can instead use the Command Line Interface (CLI) to script your interactions with AWS using the terminal.
You can use the Software Development Kits (SDKs) to write programs to interact with AWS for you.

We've been talking about a few different AWS resources, so you may be wondering, how do I actually create, use and manage these services?

So far we've been using the AWS Management Console for all our exercises, but using AWS resources goes a little deeper than that!

Let's dive into it.

APIs

In AWS, everything is an API call.

API stands for Application Programming Interface.

It sounds pretty scary, but the concept is actually quite simple!

  • Think of APIs like servers in a restaurant. Servers help you order meals, APIs help you order pre-made computer programs for your own app.
  • In a restaurant, you don't need to know how the chef prepared your meal. You don't need to know the ingredients, the knives or pans the chef used, or how long it took them to make it. You can still eat and appreciate the meal though!
  • With APIs, you don't need to understand the inner workings of a computer program to use it.
  • For example, the weather app on your phone uses APIs to fetch weather data from a remote server and then display it to you. You didn't need to understand how the app gathered that data. You simply used the app buttons to get the information you wanted.

Now back to AWS. When you provision* resources, you don't need to write complex code to explain. That's because the AWS Management Console helps us turn our requests into API calls that tell AWS what you want it to do, whether it's creating a new server, storing a file, or launching a database.

*Provisioning in AWS means setting up a resource with all the things it needs, like an operating system and memory, so it's ready for you to use. You're going to see this word in AWS a lot!

The AWS Management Console falls under a wider service category in AWS called infrastructure management. Infrastructure management = taking care of all the computers, networks, and software that a company or account uses. Management means making sure everything works well, stays safe, and can grow when needed.

You have three key options for infrastructure management:

  • AWS Management Console
  • AWS Command Line Interface
  • AWS Software Development Kits

The AWS Management Console

The AWS Management Console is browser-based, so you can just use it on Google, Safari, Firefox, or anything else you use to browse the internet.

  • You can quickly access recently used services and search for other services by name, keyword, or acronym.
  • The console includes portals and automated workflows* that can simplify the process of completing tasks.
  • Multiple identities can stay logged into the Console at the same time.
*In the context of AWS or software, workflow means = a series of automated or manual steps you need to take to achieve a goal. Setting up a server, configuring a database, or launching an application are all examples of workflows.

How convenient! It's perfect for beginners - and we've been making the most out of it in our exercises too.

Through the console, you can manage your AWS resources visually which is easy to digest. It's also useful for:

  • Building out test environments
  • Viewing AWS bills
  • Viewing monitoring reports
  • Working with other non technical resources.

The AWS Management Console is most likely the first place you will go when you are learning about AWS. But once you are up and running in a production type environment, you don't want to rely on the point and click style that the console gives you to create and manage your AWS resources.

For example, in order to create an Amazon EC2 Instance, you need to click through various screens, setting all the configurations you want, and then you launch your instance. If you wanted to launch another EC2 Instance later, you would have to click through those screens again to get it up and running.

By having humans do this manually, you're opening yourself up to potential errors. It's pretty easy to forget to check a checkbox or misspell something when you are doing everything manually.

The answer to this problem is to use tools that allow you to script or program the API calls. One tool you can use is...

Infrastructure as Code (IaC)

Infrastructure as Code (IaC) is a way to manage and set up your cloud infrastructure using code or scripts, like writing a computer program.

The AWS Management Console is 🙅🏻‍♀️ not 🙅🏻‍♀️ an example of IaC. That's because the Console relies on manual interactions on the portal - we have to click through pages, select options from dropdown lists, check/uncheck boxes manually.

With IaC, you describe what resources you need (like servers, databases, and networks) and how they should be configured, all in a file.

The AWS Command Line Interface (CLI) and Software Development Kits (SDKs) are tools that let you interact with your AWS resources using code.

  • They make it easier to create, update, and manage your cloud infrastructure programmatically!
  • You can automate and replicate your infrastructure more efficiently, just like following a detailed cooking recipe to create the same dish every time.
  • A keyword that often gets mentioned with CLI and SDKs is programmatic access, which means using code to access and interact with AWS services.

The AWS Command Line Interface (CLI)

The CLI lets you make API calls using the terminal* on your machine.

  • Enables you to control multiple AWS services directly from the command line within one tool.
  • Available for users on Windows, macOS, and Linux.
*A terminal is like a chat box for talking to your computer by typing instead of clicking with a mouse. When you're clicking on folders and files on your computer, you are using a graphic interface to tell the computer which folders or apps you want to open. A terminal, in comparison, is a text-based interface where you can type commands to make your computer do those tasks. Search for 'Terminal' in a Mac, or 'Command Prompt' in a Windows computer, to find your terminal.

Writing commands using the CLI makes actions scriptable and repeatable.

  • This makes it less vulnerable to humans making mistakes, and saves time for making API requests too.
  • You can have these scripts run automatically, like on a schedule or triggered by another process.
  • For example, you can use commands to launch an Amazon EC2 instance, connect an Amazon EC2 instance to a specific Auto Scaling group, and more. If you want to launch another, you can just run the pre-written command again.
  • Automation is very important to having a successful and predictable cloud deployment over time.

Another way to interact with AWS is through...

AWS Software Development Kits (SDKs)

SDKs make it easier for you to use AWS services through an API designed for your programming language* or platform.

  • Supported programming languages include C++, Java, .NET, and more.
  • Easy for developers to create programs that use AWS without using any low level APIs.**
  • Also avoids manual resource creation, like CLI.
  • SDKs enable you to use AWS services with your existing applications or create entirely new applications that will run on AWS.
  • To help you get started with using SDKs, AWS provides documentation and sample code for each supported programming language.
*A programming language is a way of talking to a computer to make it do what you want. Developers use programming languages to write software and create apps. Just like how people can speak in different languages, there are hundreds of programming languages used for different purposes. Each programming language has their own own set of rules and syntax (grammar) for writing code. Some popular programming languages include Python, Java, C++, and JavaScript.
**Low level APIs are APIs that offer more control and flexibility, but may require more manual set up compared to simpler methods. Low-level APIs in AWS help you use the more complex services in AWS, like Amazon S3, Amazon EC2 and Amazon RDS.
  • Think of low-level APIs as the nuts, bolts, and raw materials you use to build something. They give you precise control over what you're creating, like building a custom bicycle by hand, choosing every part and how it fits together.
  • High-level APIs are like buying a fully assembled bicycle where you don't need to worry about the individual components. You just hop on and ride because someone else has handled all the details for you.