Developers who want to work with Altostra sometimes need to go through approvals and organizational procedures in order to connect their cloud accounts. To make it easier for them we created the Playground environment, which enables them to try Altostra even before any cloud account is connected.
The Playground Environment simulates a real cloud environment for you to deploy projects without actually creating cloud resources.
You can use Altostra's tools as you would regularly, with one major difference: Once you deploy your project to the Playground environment, instead of deploying your project directly to your cloud account, Altostra will pack the infrastructure configuration and function code files into a single file, available for download.
You can then download and review these files, and also execute them manually on your cloud account if you wish.
Let's see how it works.
Things you'll need for this tutorial
- An Altostra Account (Don't have one yet? Just login here)
- Altostra CLI installed (
npm i -g @altostra/clior see docs)
- Altostra extension for Visual Studio Code (VSCode Marketplace or see docs)
Create a new project
We'll use one of Altostra's templates to create a basic project:
- In Visual Studio Code, open the directory in which you wish to create the project.
- Switch to the Altostra view
- Click "Initialize Project"
- In the Templates list, click simple-crud-service-nodejs
Now you've got the architecture of a basic Serverless CRUD application, with basic code implementation.
Deploy the Project
Now that we have the project, first we push a new version:
$ alto push v0.1
A Version is basically 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.
Since we haven't connected any cloud account, we'll use the Altostra's built-in Playground environment:
$ alto deploy sampleDeployment:v0.1 --env Playground
A Stack is the adaption of your version (code & infrastructure) to a specific environment - in this case, the Playground environment.
Altostra Playground environment stores your stack and version files for you for a month. When you connect your account, your files will be stored permanently on your account.
You can list all the currently stored versions of your project's stacks with
$ alto stacks
Get your stack
Let's download your stack file.
You can open your project in the Altostra Web Console to see its details and to download the files generated by the deployment, or simply run
# open the current project in the Altostra Web Console alto console
on your terminal, which will take you directly to your project in the Altostra Web Console.
On your project page, click the
sampleDeployment stack, and click the download link at the edge of the line
What's in the file?
The zip file you've downloaded contains 3 files:
. ├── package.zip ├── root.json └── LogShipping.json
package.zipis the zip file that contains your code and dependency modules packages
root.jsonis the CloudFormation template that you can deploy directly to CloudFormation.
LogShipping.jsonis an optional CloudFormation template you can use to connect all your Lambda's log groups to an external logging service (like Logz.io, for example). You can read more about this on our blog.