Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Setting Up a Static Public IP Address

00:00 Putting Your Site Online With Django, Gunicorn, and Nginx. At this point, your site is accessible locally on your virtual machine. If you want your site to be accessible at a real-looking URL, you’ll need to claim a domain name and tie it to the web server. In addition, there are a number of other changes needed to allow the site to be served reliably and securely.

00:26 It’s ideal if you can point your domain’s configuration to a public IP address that’s guaranteed not to change. One sub-optimal property of cloud VMs is that their public IP address may change if the instance is put into a stopped state. Alternatively, if you need to replace your existing VM with a new instance for some reason, then the resulting change in IP address would be problematic.

00:50 The solution to this dilemma is to tie a static IP address to the instance. AWS calls this an Elastic IP address. Azure calls this a Reserved IP. Follow your cloud provider’s documentation to associate a static IP address with your cloud VM.

01:09 In the AWS environment used for the example in this course, the elastic IP address 18.169.156.95 was associated to the EC2 instance. Remember that this means you’ll need to change the target IP of ssh in order to access your VM as seen on-screen.

01:31 After you’ve updated the target IP, you’ll be able to connect to your cloud VM.

01:40 Again, if needs be, you can change the prompt with the code used earlier …

01:54 and reactivate your Python virtual environment.

02:04 With a more stable public IP in front of your VM, you are ready to link to a domain, and that’s what you’ll be looking at next.

Become a Member to join the conversation.