Giter Site home page Giter Site logo

alexmhack / django-elasticbeanstalk-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 13 KB

Boilerplate django project for AWS Elastic Beanstalk.

Python 100.00%
django2 aws elastic-beanstalk boilerplate sample-project tutorial deploying-django

django-elasticbeanstalk-boilerplate's Introduction

Django-ElasticBeanstalk-Boilerplate

Boilerplate django project for AWS Elastic Beanstalk.

Follow the steps to use this repot

  1. Clone this repo

    git clone https://github.com/Alexmhack/Django-ElasticBeanstalk-Boilerplate.git cd Django-ElasticBeanstalk-Boilerplate

  2. Create and activate virtualenv by running these commands, you can even use pipenv but I prefer virtualenv

    pip install virtualenv python3 -m virtualenv env cd env/Scripts activate

  3. Now install the python packages in virutalenv from requirements.txt file

    pip install -r requirements.txt

  4. Install AWS EB CLI

  5. Create Elastic Beanstalk application

    eb init Choose your region Choose python version 3.6 Setup ssh for your instance, choose a keypair or create one

  6. Create EB Environment by running

    eb create TESTenv --database.engine postgres # <- TESTenv is the name of environment postgres is the database engine for your database, enter the username and password of your choice when prompted

    This process will take some time

  7. Change config for your elastic beanstalk environment

    eb config

    Change the WSGIPath from application.py to our projects path, starter/wsgi.py Save the file and close it, the environment update will start in cmd

  8. Add env url to ALLOWED_HOSTS

    eb status Copy the CNAME: <YOUR CNAME> and paste it in ALLOWED_HOSTS list in starter/settings.py file.

  9. Deploy

    eb deploy

  10. Open the instance url in web browser

    eb open

  11. You should see the standard Django2 start project welcome page.

  12. Now get the RDS database host endpoint and port from AWS EB console > Configuration > Database (at the bottom of webpage). Copy the endpoint and paste it in the DATABASES setting in starter/settings.py file.

Django, Elastic Beanstalk & VPC

Follow these steps to create a Elastic Beanstalk environment inside a VPC and then run a Django backend instance.

EB CLI Create Reference has all the options for our needs.

I assume you have downloaded awsebcli using pip, if not run pip install --upgrade awsebcli

Create a VPC in the AWS, here is official guide. Follow this guide before running the below commands

  1. Run the eb command eb create deploy -db.engine postgres -db.user xxxxxxxxx -db.pass xxxxxxxxx --vpc --vpc.dbsubnets xxxxxxxxx,xxxxxxxxx,xxxxxxxxx,xxxxxxxxx -k KEY_PAIR_NAME

    -db.engine -> the database engine, here postgres -db.user -> username of the database instance -db.pass -> password of the db instance --vpc -> launches environment in the Virtual Private Cloud (asks for details of vpc) --vpc.dbsubnets xxxxxxxxx,xxxxxxxxx,xxxxxxxxx,xxxxxxxxx -> the subnets of the db subnet groups -k KEY_PAIR_NAME -> If you want to connect to your instances using ssh use this option with your KEY_PAIR_NAME

  2. Next follow the same commands stated in the above section to config and deploy your environment.

django-elasticbeanstalk-boilerplate's People

Contributors

alexmhack avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jremmanue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.