Welcome to the first lesson of our course, Developing with Core AWS Services. I am excited to guide you through your first steps in cloud development.
Before we write any code, let's set the stage. In this lesson, you will learn what Amazon Web Services (AWS) actually is, get a quick tour of the services we will use throughout the course, and then learn how to use Python to communicate with them. This is the foundation for everything we will do, from storing files to managing databases.
Traditionally, if a company wanted to run an application, it had to buy physical servers, install them in a room, power them, cool them, and maintain them. This is expensive, slow, and hard to scale when your needs change.
Cloud computing flips this model around. Instead of owning hardware, you rent computing power, storage, and databases on demand from a provider, and you pay only for what you use. If you need ten servers for an hour, you rent ten servers for an hour. When you are done, you release them and stop paying.
Amazon Web Services (AWS) is the largest of these providers. It offers hundreds of services that you can combine like building blocks to create almost any kind of application — a website, a mobile backend, a data pipeline, or a machine learning system. In this course, you will learn to control a handful of these building blocks directly from your Python code.
Cloud services are usually grouped into three categories, based on how much of the work the provider handles for you:
- IaaS (Infrastructure as a Service): You rent the raw building blocks — virtual servers, networking, and storage — and you are responsible for what runs on them. In
AWS, Amazon EC2 (virtual servers) is a classic example. This gives you the most control but also the most responsibility. - PaaS (Platform as a Service): The provider manages the underlying servers for you, so you can focus on your code and data. Managed databases like DynamoDB fall closer to this category, since
AWShandles the servers, scaling, and maintenance behind the scenes. - SaaS (Software as a Service): You simply use finished software over the internet, without managing anything underneath. Think of an email service or a document editor you log into through a browser.
Understanding where a service falls on this spectrum helps you know how much AWS is doing for you versus how much you need to manage yourself.
AWS has hundreds of services, but you only need a few to build powerful applications. Here are the core services we will explore in this course, in the order you will meet them:
- Amazon S3 (Simple Storage Service): A place to store and retrieve any amount of data — files, images, backups — from anywhere on the web. Files are stored as "objects" inside containers called "buckets."
- Amazon DynamoDB: A fully managed
NoSQLdatabase for storing structured data, such as user profiles or product catalogs, with fast and predictable performance. - Amazon SQS and SNS: Two messaging services. SQS (Simple Queue Service) lets different parts of your application send messages to each other through a queue, while SNS (Simple Notification Service) lets you broadcast notifications to many subscribers at once.
- Amazon EC2 (Elastic Compute Cloud): Virtual servers in the cloud, known as instances. An EC2 instance is essentially a computer you rent from
AWSand control remotely — you can install software on it and run your own programs, just like a physical machine, but without owning the hardware.
Each of these services does something very different, yet you will talk to all of them from Python using the exact same approach. That approach is what we will learn next.
To interact with AWS using Python, we use a library called boto3. You can think of boto3 as a bridge between your Python code and the massive infrastructure of AWS.
The most important thing to learn today is the Universal Pattern. Whether you are working with a simple storage service or a complex machine learning tool, the code almost always follows these four steps:
- Import the library.
- Initialize a
clientfor the specific service you want to use. - Perform an operation (like asking for information).
- Process the response that
AWSsends back.
On your local computer, you would normally install this library using a tool like pip. However, on CodeSignal, these libraries are already installed and ready for you to use, allowing you to focus entirely on your code.
The first step in any AWS program is importing the library and creating a client. A client is a Python object that acts like a "telephone" dedicated to a specific AWS department. If you want to talk to the virtual server department, you create an EC2 client. If you want to talk to the security department, you create an STS (Security Token Service) client.
Let's start by importing the library and creating an STS client:
In this code, boto3.client('sts') tells Python to prepare a connection to the security service.
You might notice that we did not provide any passwords or "access keys" in the code. This is a best practice in professional development. boto3 automatically looks for credentials in your environment (such as hidden files or system settings). This keeps your secrets safe and out of your source code.
Once we have our "telephone" (the client), we can make a call. A great first call to make is get_caller_identity(). This is the AWS version of asking, "Who am I?" It confirms that your connection is working and tells you which account you are using.
The output will look like a standard Python dictionary:
Since the response is just a dictionary, we can extract exactly what we need using keys.
Output:
To prove that this pattern is universal, let's use it to talk to a completely different service: Amazon EC2, which provides virtual servers (called "instances").
Notice how the code structure remains exactly the same:
Output:
💡 Don't worry if you see
Found 0 EC2 instance(s)— a fresh account often has no servers yet. The call still succeeded and returned a valid response, which is exactly what a connection test needs to prove.
Even though EC2 and STS do completely different things, the way we interact with them in Python is identical. This is why learning the Universal Pattern is so powerful — once you learn it here, it transfers to every other service we cover in this course.
In the real world, things can go wrong. Your internet might cut out, or your account might not have permission to access certain data. If we do not handle these problems, our program will crash with a long, scary error message.
To fix this, we use try and except blocks. We also need to import specific error types from botocore, the lower-level library that boto3 is built on top of.
NoCredentialsError: This occurs ifboto3cannot find yourAWSkeys.ClientError: This is a general error that happens ifAWSrejects your request (for example, if you do not have permission to perform an action).
By catching these errors, we can provide the user with a helpful message instead of a broken program.
In this lesson, we covered both the big picture and the fundamental workflow for AWS development in Python:
- What AWS Is: Learned how cloud computing lets you rent computing, storage, and databases on demand instead of owning hardware.
- Service Models: Saw how services fall into IaaS, PaaS, and SaaS categories.
- Course Services: Toured the core services we will use —
S3,DynamoDB,SQS/SNS, andEC2. - The Universal Pattern: Imported
boto3, created aclient, called a method, and processed the dictionary response. - STS and EC2: Used
get_caller_identity()to verify our connection, then applied the same pattern to virtual servers. - Error Handling: Used
try/exceptwithClientErrorandNoCredentialsErrorto make our code professional and robust.
Now it's time for you to practice! In the following exercises, you will build a test_connection() function from scratch. This is a very useful tool that you can use at the start of any project to ensure your environment is ready to go. Let's head over to the IDE!
