From the course: Hands-On Development in AWS

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Using the Python SDK

Using the Python SDK

- Just like with Node, the Python SDK for AWS is very easy to use. In that same directory, 02._AWS_CLI_SDKS, I have the Python example. If we open that up, we can see that it is slightly less verbose. We create an EC2 client, and then we run ec2client.describe_instances, this function, and we get a response, and then within that response, we look at the reservations key for each of the reservations that are in that particular array. We iterate over the instances, and then if there's a public IP, we output that. Let's go ahead and run this, python3 app.py, and we see the information. I didn't do the whole match on keys and whatnot to get the name. In this particular example, I just wanted to show how simple it was to actually, I mean, this thing is what, four lines? To actually get that list of instances that is up and running, and then plus the instantiation of the objects. Regardless, it's extremely simple in order to interact with AWS services using the SDKS. We've looked at Node…

Contents