Deploying a Project to Multiple Environments
Overview
In this tutorial, we will deploy an Altostra project to several environments, each in a different AWS region.
We'll see how to:
- Create a basic project
- Create new Altostra Environments
- Push and tag a project version
- Deploy a project version to multiple Altostra Environments
Let's get started!
Things you'll need for this tutorial
- An Altostra Account (Don't have one yet? Just login here)
- Altostra extension for Visual Studio Code (VSCode Marketplace or see docs)
- A connected AWS cloud account ( Web Console settings or see docs)
- A GitHub account (Free. Don't have one yet? Just signup here)
We'll be using an Altostra template to create a simple CRUD service. If you want to learn more about the project, try our Create a Simple API Project tutorial.
Step 1: Create the sample project
In this step, we'll create the project we will be deploying.
In the Altostra Web Console:
- Go to Projects
- Click Create Project
- In the Name field we'll use
My Altostra Project
- In the Template field, click the drop-down menu and select
simple-crud-service-nodejs
This step will create the My Altostra Project
project in your GitHub account, and populate it with the template project.
You can now git clone
the project to your local machine, and open it in VSCode.
Step 2: Push the Project
Now that we have the project, we can push a new version:
alto push v1.0.0
A Version is the aggregation of your infrastructure and code before they've been adapted to a specific environment. A version can be deployed to any environment. You can read more about Altostra versions here.
Step 3: Creating the Environments
An Altostra Environment includes:
- Name - The name of the Environment, eg:
QA
,Dev
,Customer 1
. - Location - The geographical region where your stacks will be deployed to.
- Parameters - The environment variables specific for this environment (eg: DB connection strings, specific flags).
- Other Altostra integrations - logging, monitoring, and orchestration.
You can read more about Altostra Environments here
When you connected your cloud account, we created a default Altostra Environment called "Production" for you. Now we'll create two more environments - Dev
and QA
- each in a different aws region.
Creating Dev
Environment
In the Altostra Web Console:
- Go to Environments tab and click on Create Environment.
- In the name field, use "Dev"
- Select your AWS account and the us-east-2 (Ohio) region. (You can choose any region you want, but for the sake of the example we'll be using this one as
Dev
) - Click Create to finish creating the environment.
If this is the first you've created an Altostra Environment in that region, it'll take a few minutes for Altostra to initialize the region. You'll see a purple banner at the top of the screen while the environment is being initialized. Once the banner is gone, you'll be able to deploy seamlessly to that environment.
Creating QA
Environment
Repeat the steps for the creation of the Dev
env, and:
- In the Name field, enter
QA
- Select your AWS account and the us-west-2 (Oregon) region. (You can choose any region you want, but for the sake of the example we'll be using this one as
QA
) - Click Create to finish creating the environment.
Step 4: Deploying our project
Now that we have our project version (v1.0.0
) and the relevant environments (Dev
, QA
and Production
), we can deploy our project to these environments.
For more information about deploying projects, read the Deploy a Project guide.
Deploying a project creates a live release of your version in a specific environment. This live release is called a Stack
.
Deploying a project version can be done from either the CLI or the Web Console.
Deploying to the Dev environment
On the project page:
- Under Stacks, click New.
- Use
myDevStack
for Stack Name. - We'll choose our latest Version, which is
v1.0.0
. - For Environment, we'll choose our
Dev
environment. - Click Deploy to deploy the new
Dev
stack.
After we deployed to dev and checked everything, we can deploy to our QA environment.
On the project page:
- Under Stacks, click New.
- Use
myQAStack
for Stack Name. - We'll choose our only Version, which is
v1.0.0
. - For Environment, we'll choose our
QA
environment. - Click Deploy to deeply the new
QA
stack.
Summary
We created a new project and deployed it to two different environments in two different geographical regions. We can now deploy new versions to each stack to update them, add more environments, and modify each environment by using Environment Parameters and integrations.