Host your django app for free in aws ec2 windows instance.

Host your django app for free in aws ec2 windows instance. Nov. 3, 2020

Step 1: Open your account in AWS

Step 2: Sign in to Amazon Management Console.

Step 3: Click on Launch a virtual machine with ec2 or search ec2 in find services.

Step 4: Select any windows server 2019 base. 

Step 5: Click on review and launch and click previous.

Step 6: Add rule. Type- HTTP. Review and launch.

Step 7. Create a new key pair. Write any name for key pair. Launch instance.

Step 8: Click on your instance name which is followed by The following instance launches have been initiated:

Step 9: Wait for 4 minutes. Click on your instance ID then connect.

Step 10: Select RDP Client then Get Password by your key which is downloaded in step 7 and download Remote desktop file.

Step 11: Open RDP File to access AWS server. 

Step 12: Search on task bar. windows defender firewall with advanced security.  and open it.

Step 13. Click on windows defender firewall properties and allow inbound connections in all domains. Close the app. 

Step 14: Copy chrome from your original system and paste in the remote machine or download from internet explorer. 

Step 15: Open settings.py from your django app and add your domain or '*' in ALLOWED_HOSTS If you don't know django, Learn from here

ALLOWED_HOSTS = ['*']

Step 16: Run pip freeze > requirements.txt in your terminal.  Make sure terminal is in the make project directory. A file will be created which contains required modules for your Django project.

Step 17: Convert your project folder in zip or rar file.

Step 18: Copy the file and paste in remote machine. Unzip your file. You can use Winrar to unzip. 

Step 19: Open cmd and navigate to your project directory.

Step 20: Run pip install django and pip install -r requirements.txt in cmd. It will download the required files.

Step 21: Start your server using the command python manage.py runserver 0.0.0.0:80. 

Now your Django project would be live on your instance's public IP address. Tutorial to connect to domain would be updated soon. 


Rate this post

Comments