Creating a Python Web Application using Python Flask Part 5: Intro to frequently used AWS Services

In this part I’ll ask you to do some independent learning to go out and set up a free tier Amazon AWS account, so in the next part we can go out and take advantage of all the amazing cloud services amazon has build up and shared with the development community.

There are a couple reasons I really like AWS. First, how much support they actually give back to developers as part of the putting the customer first policy by creating technology as a platform as they continue to innovate in their own business. Also AWS has very flexible pricing options based on the scale of your services. They give a lot of great low maintenance features such as data replication and built in query caching with DynamoDB and very cheap object storage in S3 with in depth versioning and logging if you chose to utilize it. You can create a free tier account for one year with enough functionality to continue the next part of this tutorial easily from https://aws.amazon.com/free/ and if you decide you don’t want it after that just cancel it.

As a developer having tooling that can help us meet customer and client demands quickly yet effectively should be just as important to us as code quality. As fun as it can be to reinvent the wheel as a creator; being able to utilize abstractions that already exists is what enables us to drive the advancement of technology. The less time we have to worry about our infrastructure and service health through monitoring, will be more time we can actually make cool stuff.

Now that I got that out of the way head over to aws and make a free account. They will ask for a card but that’s only as a precaution, if you continue following along with me then we’re not going to do anything you’ll actually get billed for, but we will learn some of the most important parts of AWS for simplifying web development.

The services below are typical services that can be utilized to speed up development:

IAM – Identity Authentication Management service for creating users and handling permissions to what those users can do

DynamoDB – A very scalable nosql database based on key-value collections utilizing primary keys, sort keys, local secondary indexes and global secondary indexes to provide flexible reading patterns for your data.

S3 – Amazon’s Simple Storage Solution which is great for storing all types of files such as images, static web pages, and video files.

SQS – The amazon simple queue service allows people to generate message queues on the fly to delegate messages between application components. Message queues are commonly used to manage workflows in distributed systems. I’ll have more articles dedicated to this amazing service in the future

Elastic Beanstalk – This is an abstraction of other amazon services which enable you to deploy flask applications through the AWS Cli.

AWS Lambda: Allows for highly modular pieces of code that can be ran with http requests on the fly. I don’t know all of the best use cases for this but I do know it is used for making Amazon Alexa Skills and can also be used for complete abstract CRUD, create read update delete, on Amazon RDS or Dynamo DB. This is something I definitely want to learn more about but haven’t been able to think of a use case where I’d really get advantage out of the cost savings it may provide.

Route 53 – This is Amazon’s DNS system that can be used to assign a url to your web application. So instead of pythonflask.aws.amazon.com we can get http://www.PythonFlaskApp.com because who wouldn’t want such an awesome domain name.

EC2 – This stands for Elastic Cloud Computing and allows you to create small virtual instances in the cloud and a choice of what services you want to deploy on these such as databases, web servers such as Apache or Nginx, etc… You can spin up a huge 32 core instance with 100gb SSD and 512gb of Ram for running highly parallel machine learning training and tear it down when you are done for several dollars an hour if you wish, and reminder to tear it down because the monthly cost on those are HUGE. Or you can spin up a small 2 core, 2gb of ram instance and run a small Python Flask application and scale it as your user base grows. We could also go this route for hosting our application but I’m more interested in using this as a chance to learn elastic beanstalk as I know the whole EC2 model from my work. I’ll do the compare and contrast for the two during that section when we get there.

Seeing as how much writing this ended up being I’ll use this as a wrapping up point to let you explore more into some of these services we will be using. They are all heavily documented with tons of great tutorials and examples.

Next article we will use the IAM service to create a development user who can read and write to dynamo and s3. We’ll generate a access key and secret key pair for the user so we can access our AWS services programmatically from our python flask application, we will create our users table in a modular system to allow easily replicating our schema between our dev and prod instances, and set up some pytest to keep our code tight and think about our code methodically to put a little more weight on initial design to save us time towards the later part of a project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s