Skip to main content
⏳ Estimated read time: 3 min read

create

The stackgen appstack create command allows you to create a new appStack with specified cloud provider, components, and deployment options. To enable the CLI to dynamically retrieve the appstacks you have access to, set the STACKGEN_GIT_AUTH_TOKEN environment variable to a Git token with Read access to the desired repositories.

Usage

stackgen appstack create [flags]

Flags

FlagDescription
--appstack-name stringappStack name
--cloud-provider stringCloud provider for IaC generation (aws, gcp, azure, civo)
--componentJSON string defining the components for the appStack (can be specified multiple times)
-h, --helpHelp for create
--iac-compute stringCompute service for infrastructure as code (aws-ecs, aks-tf, k8s, aws-lambda, gke-tf, gcp-func, openshift, civo)
--scan-strategy stringDefines scan strategy: 'local' to scan local directory, 'repository' to scan remote git repository
--local-analysisRun analysis locally instead of using StackGen server

Environment Variables

VariableDescription
STACKGEN_GIT_AUTH_TOKENGit token with read access to repositories for scanning appstacks

Component Format

Local Component Format

{
"name": "component",
"source": {
"refType": "local",
"localPath": "/test-user/python-local-repo"
},
"language": "PYTHON",
"analysisPath": "internal/cmd",
"containerPath": "/app",
"containerImageReference": "docker.io/library/ubuntu:24.04"
}

Repository Component Format

{
"name": "component",
"source": {
"refType": "branch",
"gitReference": "main",
"repository": {
"name": "hello-kitty",
"url": "https://github.com/stackgen-demo/hello-kitty"
}
},
"language": "PYTHON",
"analysisPath": "internal/cmd",
"containerPath": "/app",
"containerImageReference": "docker.io/library/ubuntu:24.04"
}

Examples

Create an AWS appStack with a local component

stackgen appstack create \
--appstack-name my-local-app \
--cloud-provider aws \
--scan-strategy local \
--component '{
"name": "web-service",
"source": {
"refType": "local",
"localPath": "/home/user/projects/web-service"
},
"language": "PYTHON",
"analysisPath": "src",
"containerPath": "/app",
"containerImageReference": "docker.io/library/python:3.10"
}'

Create an appStack using a repository component

export STACKGEN_GIT_AUTH_TOKEN=ghp_your_token_here
stackgen appstack create \
--appstack-name my-microservices \
--cloud-provider gcp \
--scan-strategy repository \
--iac-compute gke-tf \
--component '{
"name": "api-service",
"source": {
"refType": "branch",
"gitReference": "main",
"repository": {
"name": "api-service",
"url": "https://github.com/myorg/api-service"
}
},
"language": "JAVA",
"analysisPath": "src/main",
"containerPath": "/app",
"containerImageReference": "docker.io/library/openjdk:17"
}'

Create an appStack with multiple components

stackgen appstack create \
--appstack-name multi-component-app \
--cloud-provider aws \
--scan-strategy repository \
--iac-compute aws-ecs \
--component '{
"name": "frontend",
"source": {
"refType": "branch",
"gitReference": "main",
"repository": {
"name": "frontend",
"url": "https://github.com/myorg/frontend"
}
},
"language": "PYTHON",
"analysisPath": "src",
"containerPath": "/app",
"containerImageReference": "docker.io/library/python:3.9"
}' \
--component '{
"name": "backend",
"source": {
"refType": "branch",
"gitReference": "main",
"repository": {
"name": "backend",
"url": "https://github.com/myorg/backend"
}
},
"language": "JAVA",
"analysisPath": "src/main",
"containerPath": "/app",
"containerImageReference": "docker.io/library/openjdk:17"
}'
note

If you run into issues creating appstacks for repositories you have access to, try selecting the --local-analysis flag to run the analysis locally.