Guide to provisioning an AWS Cloud9 IDE, cloning a CodeCommit repository, inspecting a Flask app, and preparing to containerize it with Docker
Welcome back. In this lesson you’ll provision an AWS Cloud9 IDE and prepare a development workspace for the sample application used throughout this course. Follow the steps below to create the environment, inspect the repository, and run the initial app files.
Open the AWS Management Console and search for Cloud9. Select the Cloud9 service. If you use Cloud9 frequently, bookmark it — bookmarked services appear in the left panel.
Create a new Cloud9 environment:
Click “Create environment”.
Provide a name (this lesson uses CodingGround) and an optional description.
Leave other settings at their defaults unless you have specific instance size or networking requirements.
Cloud9 will provision the required backend resources (it creates and configures an EC2 instance for your IDE). Provisioning typically takes 5–10 minutes. When the environment is ready, click “Open” to launch the Cloud9 editor in a new tab and wait for the IDE to initialize and connect.
Cloud9 uses an EC2 instance billed to your account. If you want to avoid ongoing charges, stop or terminate the instance when not in use.
Once connected, the Cloud9 interface provides a complete development workspace: the file tree is on the left, the editor in the center, and an integrated terminal at the bottom.
For example, opening the repository README.md displays the file in the editor while leaving the terminal available for commands.
Next: clone the course repository from AWS CodeCommit into your Cloud9 environment.
In the AWS Console, open CodeCommit and copy the repository’s HTTPS clone URL.
Important: Your Cloud9 EC2 instance must be able to authenticate to CodeCommit. If you see authentication errors while cloning, ensure either:
The Cloud9 EC2 instance has an IAM role attached with the necessary CodeCommit permissions, or
You have configured the AWS CLI credential helper / Git credentials for CodeCommit on the instance.
Now switch to the Cloud9 terminal and run the clone command. Example output:
After cloning, a new folder aws-microservice-project appears in the Cloud9 file tree. Expand it to inspect project files. Typical top-level files and folders include:
File / Folder
Purpose
app.py
Main Flask application entry point.
templates/
HTML templates (e.g. login.html, product.html).
static/
Static assets like CSS and images.
README.md
Project overview and setup instructions.
Below is an excerpt from app.py to show the basic Flask structure and where the database client will be integrated later:
from flask import Flask, render_template, request, redirect, url_forimport psycopg2 # Will be used later for PostgreSQL connectionsapp = Flask(__name__)# Default credentialsDEFAULT_USERNAME = "admin"DEFAULT_PASSWORD = "password123"@app.route('/', methods=['GET', 'POST'])def login(): error = None if request.method == 'POST': username = request.form['username'] password = request.form['password'] # Check if provided credentials match the default ones if username == DEFAULT_USERNAME and password == DEFAULT_PASSWORD: return redirect(url_for('welcome')) else: error = 'Invalid Credentials. Please try again.' return render_template('login.html', error=error)@app.route('/welcome')def welcome(): return render_template('product.html')@app.route('/place_order')def place_order(): product_id = request.args.get('product') return render_template('place_order.html', product_id=product_id)@app.route('/submit_order', methods=['POST'])def submit_order(): # Code to handle order submission will be added later pass
If you prefer to work locally instead of in Cloud9, cloning CodeCommit on your machine requires proper authentication (CodeCommit credential helper or SSH keys). For more details, see AWS CodeCommit documentation: