- The infrastructure required for this application uses exclusively "serverless", pay-per-use infrastructure. If your load won't get high, these costs will be close to $0.
If you're deploying from your local machine (not from a CI/CD pipeline), you need the following prerequisites:
1. Generate your project
The command below will bootstrap the project with pre-built application code and pre-configured
stacktape.yml config file.
Copystp init --projectId gatsbyjs-website
2. Deploy your stack
- To provision all the required infrastructure and to deploy your application to the cloud, all you need is a single command.
- The deployment will take ~5-15 minutes. Subsequent deploys will be significantly faster.
Copystp deploy --stage <<stage>> --region <<region>>
stage is an arbitrary name of your environment (for example staging, production or dev-john)
region is the AWS region, where your stack will be deployed to. All the available regions are listed below.
|Region name & Location||code|
|US East (Ohio)||us-east-2|
|US East (N. Virginia)||us-east-1|
|US West (N. California)||us-west-1|
|US West (Oregon)||us-west-2|
|Africa (Cape Town)||af-south-1|
|Asia Pacific (Hong Kong)||ap-east-1|
|Asia Pacific (Mumbai)||ap-south-1|
|Asia Pacific (Osaka-Local)||ap-northeast-3|
|Asia Pacific (Seoul)||ap-northeast-2|
|Asia Pacific (Singapore)||ap-southeast-1|
|Asia Pacific (Sydney)||ap-southeast-2|
|Asia Pacific (Tokyo)||ap-northeast-1|
|Middle East (Bahrain)||me-south-1|
|South America (São Paulo)||sa-east-1|
3. Test your application
After a successful deployment, some information about the stack will be printed to the console (URLs of the deployed services, links to logs, metrics, etc.).
- Explore the app by visiting webBucket -> cdnUrl. URL was printed into console after the deploy.
4. Hotswap deploys
Stacktape deployments use AWS CloudFormation under the hood. It brings a lot of guarantees and convenience, but can be slow for certain use-cases.
To speed up the deployment, you can use the --hotSwap flag that avoids Cloudformation.
Hotswap deployments work only for source code changes (for lambda function, containers and batch jobs) and for content uploads to buckets.
If the update deployment is not hot-swappable, Stacktape will automatically fall back to using a Cloudformation deployment.
Copystacktape deploy --hotSwap --stage <<stage>> --region <<region>>
5. Delete your stack
- If you no longer want to use your stack, you can delete it.
- Stacktape will automatically delete every infrastructure resource and deployment artifact associated with your stack.
Copystp delete --stage <<stage>> --region <<region>>
Stacktape uses a simple
stacktape.yml configuration file to describe infrastructure resources, packaging, deployment
pipeline and other aspects of your services.
You can deploy your services to multiple environments (stages) - for
dev-john. A stack is a running instance of a service. It consists of your application
code (if any) and the infrastructure resources required to run it.
The configuration for this service is described below.
1. Service name
You can choose an arbitrary name for your service. The name of the stack will be constructed as
- Every resource must have an arbitrary, alphanumeric name (A-z0-9).
- Stacktape resources consist of multiple (sometimes more than 15) underlying AWS or 3rd party resources.
Bucket contains the built Gatsby website:
- The built website is automatically uploaded into the bucket as a part of the deployment process.
- CDN is configured in front of the bucket to deliver your website across the world with minimal latency.
- To ensure that the CDN always serves the newest version of the website, CDN cache is automatically invalidated (flushed) after each deployment.
Copyresources:webBucket:type: bucketproperties:directoryUpload:directoryPath: ./publicheadersPreset: gatsby-static-websitecdn:enabled: trueinvalidateAfterDeploy: true
3. Application build hook
Copyscripts:build:# or "yarn build"executeCommand: npm run buildhooks:- triggers: ['before:deploy', 'before:bucket:sync']scriptName: build
You can also execute the script manually anytime using