Do you want to learn how to implement VPC and EC2 resources with Python code on AWS? Do you want to launch EC2 Instances with Python code on AWS? Are you preparing for the AWS Solutions Architect Associate Exam and want to put your theory and skills into practice with VPC and EC2? This is the course for you.
In this course, we’ll start by taking a look at the tools and the environment that we need to work with AWS resources. We’ll be using Python 3 and as per the IDE I recommend you use PyCharm from Jetbrains. It has a free community edition even.
After I teach you how you can set up your environment on both macOS and Windows, we’ll create our credentials for AWS as being the AWS Access Key and AWS Secret Access Key for programmatic access to AWS resources. You’ll learn how you can set your AWS credentials globally on your computers using AWS CLI. Before jumping into the implementation, for one last tip, I’ll show you how you can have auto-complete capabilities on your PyCharm IDE with PyBoto3.
Once we’re ready with our environment setup, we’ll start implementing our solution on AWS. And remember we’ll do everything with Python code; not a single thing manually or by hand. We’ll start by creating a VPC. For our own VPC, we’ll provide CIDR IP block to isolate our resources within that VPC.
Then we will create two subnets; Public and Private. The public subnet will be where we will put our internet-facing resources like public EC2 instances and we will definitely launch an EC2 instance in it. To achieve this, we will create an internet gateway or IGW and attach it to our VPC. But of course, that is not enough. We will create a route table for public routes over the internet and also add our internet gateway to the route table to allow internet access to our public EC2 instance. We will also not forget to associate our public subnet with this public route table so it can be exclusively used by the public subnet and its subresources. And finally, we will modify our public subnet so it can automatically assign public IP addresses to the resources we will launch within this public subnet. That's the way we are going to achieve internet access to and from our public EC2 instance and again we will do all of that with our Python code.
Besides, we will create a private subnet for our internal resources like a private EC2 instance which will only be accessible through the private or public subnet; not open to the world. To achieve this, we will associate our default route table with our private subnet and then we will not add our internet gateway to this route table so it will basically not have any internet access. We will also not enable auto-assign public IP addresses on private subnet which is disabled by default. That's basically how we are going to disable internet traffic on our private EC2 instance again we will do all this with our Python code.
We will not stop there of course so before we launch our public EC2 instance, we will develop a startup bash script to automatically run when we launch our EC2 instance. In this script, we will first update our packages with yum package manager so we can stay up-to-date with the latest updates and security patches. Then we will install an HTTP server on it and make sure it's working by a startup check command. After we prepare our HTTP server, we will develop a simple HTML page as a greeting and we will write this page to disk to be served when we try to access our public EC2 instance. And remember, we will again do all of this with our Python code.
After finishing up launching our EC2 instances, we'll move on to learn how to describe EC2 instances on AWS in a detailed way; from their IP addresses to the subnet which they belong to. Then we'll learn how to manage EC2 instances in various ways. We'll stop, start and terminate EC2 instances and again the best part is we will do all of that with our Python code.
Lots of information, hands-on practice, and experience is waiting for you in this course on AWS. So, don't miss any more time and join me in this course to sharpen your skills on AWS using Python and Boto3.