This AWS orchestration service allows you to be agile!

This AWS orchestration service allows you to be agile!Arash KavianiBlockedUnblockFollowFollowingJun 11It is so common that a data scientist needs to create a web dashboard application or a working proof of concept.

Like most of the things data scientists do, it should be done in an agile and neat way.

In my last project, I was asked to create a dashboard for a system dynamic model to be used in a workshop as a proof of concept.

In that work, I created a dashboard using Django with diagrams visualised using plotly.

Django has various apps for dashboard development such as Django-controlcentre, Django-dash, Django admin tools and so and so forth.

You could find a list of them in this link.

Maintenance and deployment are always of main concern when you develop an application in an agile way.

Practically, due to the nature of these types of works, there is not enough amount of money to be spent on deployment and maintenance.

Therefore, you need a solution that allows you to deploy your application very quickly and let it go under use with the minimum maintenance!AWS Elastic Beanstalk provides you with this solution.

It is an orchestration service that allows users to deploy their applications very quickly.

It is an orchestration service because it comes with connectivity and integration to many other AWS services such as EC2, S3, Simple Notification Service (SNS), CloudWatch, autoscaling, and Elastic Load Balancers.

It also provides access to various AWS services such as Relation Database Services (RDS) that provides users with fully managed database services.

It is fast and straightforward while it takes care of load balancing as well as scaling your application up and down automatically.

Figure 1: EB benefits.

Source: AWSYou need to create an application in Elastic Beanstalk.

Then you can create different environments such as development, test and production very quickly in that application.

Figure 2 illustrates how Elastic Beanstalk is conceptually working.

Everything is fully managed by Elastic Beanstalk, which makes its use an absolute charm!.Perhaps, you only need to get yourself familiar with it initially.

After that, it is quite straightforward.

Figure 2: Process overview of using Elastic Beanstalk.

Source: AWSIn my case, I only needed to install EB CLI and use to initialise, create and deploy my application following the steps given in this link.

It goes without saying that you may deal with some issues down the path you are creating your environment.

I mention some of the common issues that you may need to cope with as follows:You need to make sure that the allocated AWS instance has been configured in your settings.

py as ALLOWED_HOSTS:ALLOWED_HOSTS = ['127.

0.

0.

1','xxxxx.

xxx.

ap-xxx-x.

elasticbeanstalk.

com']More information: https://stackoverflow.

com/questions/34428877/django-allowed-host-setting-for-elastic-beanstalk-instance-behind-elastic-load-bEnsure that you add new and changed files to the staging area and commit your changes before you deploy the new version of your code.

See this document for using EB CLI and Git.

Remember that you need to initialise your Git rep first and commit all changes before deployment.

When you initialise your application, ensure that you are using the right version of python:eb init -p python-3.

6 sd-dashboardMake sure that you create Django.

config file in .

ebextensions folder in the root directory of your Django project and not in .

elasticbeans talk folder.

This config file provides the EB with the required information about where Django wsgi file is located.

option_settings: aws:elasticbeanstalk:container:python: WSGIPath: system_dynamic_dashboard/wsgi.

pyThe static files should be configured as below:STATIC_URL = '/assets/'STATIC_ROOT = os.

path.

join(BASE_DIR, 'assets')# and then in django.

config, you should have something similar to:option_settings: aws:elasticbeanstalk:container:python: WSGIPath: system_dynamic_dashboard/wsgi.

py "aws:elasticbeanstalk:container:python:staticfiles": /assets/: "assets/"Database configuration can be done in EB console.

In “Configurations”, create your database.

The database is created as part of the “AWS managed Relational Database Service (RDSA)” and you can do further configuration there.

If you want to use the same database during the development, you need to make sure that the right port accesses has been given to the instance.

This can be done in the AWS RDS console where you pick your database and add the required “Security group rules”.

You need to have the following configuration in settings.

py:if 'RDS_HOSTNAME' in os.

environ: DATABASES = { 'default': { 'ENGINE': 'django.

db.

backends.

postgresql_psycopg2', 'NAME': os.

environ['RDS_DB_NAME'], 'USER': os.

environ['RDS_USERNAME'], 'PASSWORD': os.

environ['RDS_PASSWORD'], 'HOST': os.

environ['RDS_HOSTNAME'], 'PORT': os.

environ['RDS_PORT'], } }Following link also elaborates on the deployment of a Django application into EB:https://realpython.

com/deploying-a-django-app-and-postgresql-to-aws-elastic-beanstalk/.

. More details

Leave a Reply