# Connect AWS
Source: https://docs.neterial.cloud/cloud-providers/connect-aws
This guide will help you to connect your AWS account to Neterial
## Using Neterial Web Console
1. Go to [Add AWS Cloud Provider page](https://console.neterial.cloud/user/add-provider?provider=aws)
2. Click "Connect AWS". It will open "Quick create stack" page in AWS console.
3. Select the "I acknowledge that AWS CloudFormation might create IAM resources with custom names" checkbox
4. Click the "Create stack" button. This will run installation.
5. Go back to [Providers page](https://console.neterial.cloud/user/providers) and wait \~1 min until the AWS provider gets status "Connected"
# Connect Hetzner Cloud
Source: https://docs.neterial.cloud/cloud-providers/connect-hetzner-cloud
This guide will help you to connect your Hetzner Cloud account to Neterial
## Generating an API token
To generate an API token on your [Cloud Console](https://console.hetzner.cloud/), please open your project and do the following:
1. Go to **Security** on the left menu bar
2. Go to **API tokens** on the upper menu bar
3. Select **Generate API token**
4. Create your API token
* Enter a description in the upper text box.
* Choose a permission. You can choose between **Read** and **Read & Write**.
If you select **Read**, the token will only be allowed to perform GET requests.
If you select **Read & Write**, the token will be allowed to perform GET, DELETE, PUT and POST requests.
5. Copy your API token
You now have an API token. Note that it is not possible to view the token again once the window has been closed.
**Please note:** Your secret API token has to be included in **every request** you send to the API.
Example [curl](https://curl.se/):
```
curl \
-H "Authorization: Bearer $API_TOKEN" \
...
```
# Neterial CLI
Source: https://docs.neterial.cloud/guides/cli
Command-line interface for Neterial services. Learn how to install, connect clouds, and manage VMs.
Command-line interface for [Neterial](https://neterial.cloud) services.
## Installation
Linux, macOS (brew), and Windows WSL:
```sh theme={null}
curl -sSL https://get.neterial.cloud/cli.sh | bash
```
Read INSTALL.md for details and alternative ways to install.
## Quick start
```sh theme={null}
# Login
neterial auth login
# Add your SSH key (for git push deployments)
neterial ssh-key add --auto-detect
# Connect your cloud (aws or hcloud)
neterial provider init hcloud
# Create your first VM
neterial infra create vm --cloud hcloud
```
Now you can deploy your apps using `git push` or use your VM as a Kubernetes cluster.
## Authentication
Login to your Neterial account:
```sh theme={null}
neterial auth login
```
Logout:
```sh theme={null}
neterial auth logout
```
## Cloud providers
Check your connected clouds:
```sh theme={null}
neterial provider list
```
You need to have a Hetzner Cloud account. If you don't have one yet, you can
register with **[our referral link](https://hetzner.cloud/?ref=0yqTdglfKp3w)**
and receive €20 in Hetzner Cloud credits.
Read [how to create an API token in Hetzner Cloud](/cloud-providers/connect-hetzner-cloud).
Connect your cloud by adding a Hetzner Cloud API token:
```sh theme={null}
neterial provider init hcloud
```
Read [how to add AWS credentials](/cloud-providers/connect-aws).
Connect your cloud by adding AWS credentials:
```sh theme={null}
neterial provider init aws
```
## SSH keys
Add your SSH public key to enable `git push` deployments.
The `--auto-detect` flag tries to discover your SSH key automatically:
```sh theme={null}
neterial ssh-key add --auto-detect
```
Or specify a key file:
```sh theme={null}
neterial ssh-key add ~/.ssh/id_ed25519.pub
```
List your SSH keys:
```sh theme={null}
neterial ssh-key list
```
Delete an SSH key:
```sh theme={null}
neterial ssh-key delete
```
## VMs
### Create VM
Create with default settings:
```sh theme={null}
neterial infra create vm
```
Set name and cloud provider (`hcloud` or `aws`):
```sh theme={null}
neterial infra create vm --name [VM_NAME] --cloud [CLOUD]
```
Set location:
```sh theme={null}
neterial infra create vm --cloud hcloud --location ash
neterial infra create vm --cloud aws --location us-east-1
```
### List VMs
```sh theme={null}
neterial infra get vms
```
### Delete VM
```sh theme={null}
neterial infra delete vm --name [VM_NAME]
```
### VM types
You can choose the VM type when creating to control compute capacity:
```sh theme={null}
neterial infra create vm --name [VM_NAME] --vm-type [VM_TYPE]
```
## Accessing your VM
### Get kubeconfig
Get kubeconfig for the default VM:
```sh theme={null}
neterial infra get kubeconfig
```
Get kubeconfig for a specific VM:
```sh theme={null}
neterial infra get kubeconfig --cluster [VM_NAME]
```
Then access your cluster:
```sh theme={null}
kubectl get nodes
```
### List nodes
View the Kubernetes nodes in your cluster:
```sh theme={null}
neterial infra get nodes --cluster [VM_NAME]
```
## Deploying apps
Deploy your apps using git push. First, add your VM as a git remote:
```sh theme={null}
git remote add neterial git@git.[WORKLOAD_HOSTNAME]:[APP_NAME].git
```
Then push to deploy:
```sh theme={null}
git push neterial main
```
Your app will be available at `https://[APP_NAME].[WORKLOAD_HOSTNAME]`.
Use `neterial infra get workload-hostname` to get your VM's hostname.
## Container registry
Each VM includes a pre-installed container registry for storing your Docker images.
Get container registry credentials:
```sh theme={null}
neterial infra get registry
```
Get registry for a specific VM:
```sh theme={null}
neterial infra get registry --name [VM_NAME]
```
Get credentials and automatically run `docker login`:
```sh theme={null}
neterial infra get registry --docker-login
```
Get only the registry hostname:
```sh theme={null}
neterial infra get registry --hostname
```
## Workload hostname
Each VM has a unique hostname. Your deployed apps are available at subdomains of this hostname, e.g., `https://myapp.[WORKLOAD_HOSTNAME]`.
Get the workload hostname:
```sh theme={null}
neterial infra get workload-hostname --cluster [VM_NAME]
```
## Account
### Delete account
**Warning: This operation will permanently remove your Neterial account.**
You will still have access to your VMs, but you will no longer be able to manage them using the Neterial platform.
```sh theme={null}
neterial account delete
```
# Deploy App to k8s
Source: https://docs.neterial.cloud/guides/deploy-app-to-k8s
Deploy an application to Kubernetes using kubectl
Deploy a simple nginx app using Kubernetes manifests. This verifies your cluster is working and shows the kubectl workflow.
## Prerequisites
Complete [Getting Started](/index) steps 1-5 to set up CLI and create a VM.
## Get your workload hostname
```sh theme={null}
neterial infra get workload-hostname
```
Save this value - you'll need it for the Ingress configuration.
## Create the manifest
Create a file named `web-app.yaml` with the following content, or [download it here](/guides/web-app.yaml.txt).
Replace `` with your actual hostname from the previous step.
```yaml theme={null}
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
spec:
replicas: 1
selector:
matchLabels:
app: web-app
template:
metadata:
labels:
app: web-app
spec:
containers:
- name: web-app
image: nginx
command:
- /bin/sh
- -c
- "echo 'Hello from k8s!' > /usr/share/nginx/html/index.html && nginx -g 'daemon off;'"
---
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
selector:
app: web-app
ports:
- port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-app
annotations:
kubernetes.io/ingressClassName: "traefik"
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
traefik.ingress.kubernetes.io/router.tls.certresolver: default
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: "web-app."
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-app
port:
number: 80
```
## Deploy
```sh theme={null}
kubectl apply -f web-app.yaml
```
## Verify
Check the deployment is ready:
```sh theme={null}
kubectl get deployment web-app
```
Get your app URL:
```sh theme={null}
kubectl get ingress web-app -o jsonpath='{.spec.rules[0].host}'
```
Open `https://` in your browser. You should see:
> Hello from k8s!
TLS certificate is provisioned automatically (may take a minute).
## Clean up
```sh theme={null}
kubectl delete -f web-app.yaml
```
# Deploy Next.js Application
Source: https://docs.neterial.cloud/guides/deploy-next-js
Deploy a [Next.js](https://nextjs.org/) application with git push.
## Prerequisites
Complete [Getting Started](/index) steps 1-5 to set up CLI and create a VM.
## Create Next.js app
```sh theme={null}
npx create-next-app@latest my-app --yes
cd my-app
```
Test locally:
```sh theme={null}
npm run dev
```
## Deploy
Add the git remote (copy from VM creation output):
```sh theme={null}
git remote add neterial git@git..neterial.app:my-app.git
```
Push to deploy:
```sh theme={null}
git push neterial main
```
Your app URL will appear in the output.
## Re-deploy
Just push again:
```sh theme={null}
git push neterial main
```
## Advanced
For deploying with Kubernetes manifests, see [Deploy App to k8s](/guides/deploy-app-to-k8s).
# Getting Started
Source: https://docs.neterial.cloud/index
Deploy your first app in minutes using git push
```sh theme={null}
curl -sSL https://get.neterial.cloud/cli.sh | bash
neterial auth login
neterial ssh-key add --auto-detect
neterial provider init hcloud # or: neterial provider init aws
neterial infra create vm --cloud hcloud # or: --cloud aws
# In your app repo:
git remote add neterial git@git..neterial.app:.git
git push neterial main
```
## 1. Install CLI
```sh theme={null}
curl -sSL https://get.neterial.cloud/cli.sh | bash
```
## 2. Log in
```sh theme={null}
neterial auth login
```
New users can create an account during login.
## 3. Add your SSH key
```sh theme={null}
neterial ssh-key add --auto-detect
```
## 4. Connect your cloud
```sh theme={null}
neterial provider init hcloud
```
Or connect via UI: [Connect Hetzner Cloud](/cloud-providers/connect-hetzner-cloud)
```sh theme={null}
neterial provider init aws
```
Or connect via UI: [Connect AWS](/cloud-providers/connect-aws)
Verify that the cloud is connected:
```sh theme={null}
neterial provider list
```
## 5. Create a VM
```sh theme={null}
neterial infra create vm --cloud hcloud
```
```sh theme={null}
neterial infra create vm --cloud aws
```
Example output:
```console theme={null}
Creating VM "default" in hel1 on hcloud...
Waiting for the VM to be ready.............
VM is ready (k3s installed)
Access your cluster:
kubectl --context default-neterial-admin@default-neterial cluster-info
Deploy apps with git push:
git remote add neterial git@git.01kfybgvn6ewjrgsrzkseqcgpt.neterial.app:.git
git push neterial main
```
## 6. Deploy your app
Go to your app's repository.
```sh theme={null}
npx create-next-app@latest my-app
cd my-app
```
Copy the git remote command from the output and run it in your repository:
```sh theme={null}
git remote add neterial git@git..neterial.app:.git
```
Push to deploy:
```sh theme={null}
git push neterial main
```
You will see the URL in the output:
```console theme={null}
remote: Deployed! Application URL:
remote: -------------------------------------------------------
remote: https://hello.01kfxd43vxe0ran5xhwjtd4m5n.neterial.app
remote: -------------------------------------------------------
```
Open the URL to see your app running.
## Next step
For deploying with Kubernetes manifests instead of git push, see [Deploy App to k8s](/guides/deploy-app-to-k8s).