# Install in cloud with installer

Install Platforma in AWS or Google Cloud with the installer of MiLaboratories: the CloudFormation stack or install.sh in Cloud Shell.

Other ways: [Install in cloud with Terraform](/install-cloud-terraform/).

The installer makes the cluster and all its cloud parts and installs Platforma, from a few answers: you do not need to know Kubernetes (A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster.) or Terraform. On AWS, the installer is a CloudFormation stack that you create in the AWS console. On Google Cloud, it is the script `install.sh`, which you run in Cloud Shell. The Terraform modules (The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster.) are the other installation path in these clouds: for which of the two fits, see [Installation paths](/plan-choose-installation-path/#installation-paths), and for the modules, see [Install in cloud with Terraform](/install-cloud-terraform/).

## What you get

#### Variant: AWS

The installer for AWS is one CloudFormation stack. You give it a domain, the Route 53 zone of the domain and the license key, and it makes all the infrastructure in the AWS account and installs Platforma:

- a VPC in three availability zones with one NAT gateway, or the subnets of a VPC that exists;
- an EKS cluster with a system node and a node of 16 CPUs (The compute units of a node or of the server, as Kubernetes and the operating system count them. A job asks for a number of CPUs. The cloud quotas call them vCPUs.) and 64 GiB for the Backend (The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs.), which run all the time. The node groups for jobs (One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster.) scale from zero: a job node starts only when a job needs it. Where the region offers GPUs, the stack also adds GPU node groups, which also scale from zero;
- an S3 bucket as the primary storage (The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files.), which the Backend reads and writes with its [cloud identity](/infrastructure-contract-identity/), with no access keys;
- an Amazon EFS file system as the workspace (The storage where the Backend and all jobs keep the working files of running jobs. The Backend and the jobs use it at the same time. In Kubernetes, it is a network file system; in Single Server mode, it is a folder on the server.), and EBS volumes for the database and the logs of the Backend;
- the entry point (The way in to the Backend from outside the cluster, a load balancer or an Ingress with a DNS name. It usually ends TLS and sends the traffic to the Backend pod.): an Application Load Balancer with an ACM certificate for the domain, and the DNS record of the domain in the Route 53 zone. ACM renews the certificate;
- the job queues and the autoscaler, and Platforma itself. The installer installs Platforma with its own Helm chart, and the stack parameters set all its values.

Each installation has an administrator login, `platforma`, also when you set no sign-in provider (A configured way for users to sign in to the Backend: single sign-on (SSO), LDAP or a static list of users. One Backend can have more than one.). The stack makes its password and keeps it in AWS Systems Manager Parameter Store: the outputs `AdminUsername` and `AdminPasswordSSMConsole` give the login and a link to the password. Users sign in (To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in".) with the sources that you set in the stack parameters: Google, Microsoft Entra ID, LDAP (The directory of users of a company. The Backend can check logins and passwords in it.) or a static list of users (A sign-in provider that is a file with the logins and the password hashes of the users, in the htpasswd format. The Backend reads it again when it changes.).

The deployment size sets the largest job and how many jobs run at the same time:

| Deployment size   | Largest job       | Recommended vCPU quota | Minimum vCPU quota |
| ----------------- | ----------------- | ---------------------- | ------------------ |
| `small` (default) | 62 CPUs, 484 GiB  | 400                    | 190                |
| `medium`          | 94 CPUs, 733 GiB  | 950                    | 410                |
| `large`           | 94 CPUs, 733 GiB  | 1,900                  | 756                |
| `xlarge`          | 126 CPUs, 973 GiB | 3,400                  | 1,700              |

A larger size lets more jobs run at the same time; it does not cost more while the job nodes are empty. For the time and the cost of the analyses, see [Size and cost of an analysis](/plan-analysis-size-and-cost/).

#### Variant: Google Cloud

The installer for Google Cloud is the script `install.sh`, which you run in Cloud Shell. It asks for about ten answers and makes all the infrastructure in the Google Cloud project with two Infrastructure Manager deployments, `<name>-infra` and then `<name>-platforma`:

- a VPC with Cloud NAT and a GKE cluster with private nodes: a system node and a node of 16 CPUs and 64 GiB for the Backend run all the time. The nodes for jobs scale from zero: GKE makes a job node only when a job needs it. GPU nodes with NVIDIA L4 and RTX PRO 6000, in the zones that offer them, also scale from zero;
- a Cloud Storage bucket as the primary storage, which the Backend reads and writes with its [cloud identity](/infrastructure-contract-identity/), with no access keys;
- Filestore (zonal, SSD) as the workspace, and persistent disks for the database and the logs of the Backend;
- the entry point: a static IP address, the DNS record of the domain in the Cloud DNS zone, and a certificate of Certificate Manager. Google renews the certificate;
- the job queues and Platforma itself. The installer installs Platforma with its own Helm chart, and your answers set all its values.

The script also makes the service account `platforma-im-deployer` with the role Owner in the project: Infrastructure Manager makes the resources with this account. Each installation has an administrator login, `platforma`, also when you choose no sign-in provider. The installer makes its password, keeps it in Secret Manager and at the end shows the command that reads it. Users sign in with the sign-in providers that you choose: Google, Microsoft Entra ID, another OIDC provider, LDAP or a static list of users.

The deployment size sets the largest job, how many jobs run at the same time and the size of the workspace:

| Deployment size   | Largest job       | CPUs for all jobs | Workspace |
| ----------------- | ----------------- | ----------------- | --------- |
| `small` (default) | 62 CPUs, 484 GiB  | 320               | 1,024 GiB |
| `medium`          | 94 CPUs, 731 GiB  | 640               | 2,048 GiB |
| `large`           | 94 CPUs, 731 GiB  | 1,280             | 4,096 GiB |
| `xlarge`          | 126 CPUs, 824 GiB | 2,560             | 8,192 GiB |

Filestore bills the full capacity of the workspace all the time, also while no job runs.

For the time and the cost of the analyses, see [Size and cost of an analysis](/plan-analysis-size-and-cost/).

## Before you start

Prepare these items:

- **A domain and its public DNS zone** in the same cloud: a Route 53 hosted zone on AWS, a Cloud DNS zone in the same project on Google Cloud. Users type the domain in the Desktop App (The program that each user installs on their own computer to work with Platforma. It is a client of the Backend.), for example `platforma.example.com`. The parent zone must delegate to this zone, because the cloud checks the domain through it before it gives the certificate. Check the delegation with `dig +short NS example.com`: the answer must show the name servers of the zone. The Desktop App needs a valid certificate, so an IP address or a self-signed certificate does not work.
- **The license key.** See [License](/configuration-license/).
- **The Desktop App** on your computer, to connect at the end.

#### Variant: AWS

- **Rights.** An administrator of the AWS account can install. When you have fewer rights, attach the three policy documents `deployer-policy-1-infra.json`, `deployer-policy-2-services.json` and `deployer-policy-3-iam.json` of the [AWS permissions reference](https://github.com/milaboratory/platforma-helm/blob/release/5.0/infrastructure/aws/cloudformation/permissions.md) to the user or role that creates the stack. Replace their placeholders `<ACCOUNT_ID>`, `<REGION>`, `<CLUSTER_NAME>` and `<HOSTED_ZONE_ID>` first.
- **The vCPU quota** of the region. In the Service Quotas console, open [Running On-Demand Standard instances](https://console.aws.amazon.com/servicequotas/home/services/ec2/quotas/L-1216C47A) (`L-1216C47A`) and read the applied value. Choose the largest deployment size that the quota allows, or ask AWS for more. When the quota is less than the minimum of the size, the installation of Platforma stops with an error.

#### Variant: Google Cloud

- **A Google Cloud project** with billing turned on. The installer stops when billing is off.
- **Rights.** The role Owner in the project is enough. Or give the Google user who runs the installer these roles in the project: `roles/billing.viewer`, `roles/serviceusage.serviceUsageAdmin`, `roles/dns.reader`, `roles/cloudquotas.viewer`, `roles/iam.serviceAccountAdmin`, `roles/resourcemanager.projectIamAdmin`, `roles/config.admin`, `roles/secretmanager.admin`, `roles/storage.admin`, `roles/container.developer`, and `roles/iam.serviceAccountUser` on the service account `platforma-im-deployer`. For the details, see the [Google Cloud permissions reference](https://github.com/milaboratory/platforma-helm/blob/release/5.0/infrastructure/gcp/permissions.md).
- **The role `roles/config.admin`** (Infrastructure Manager Admin) is necessary on each run of the installer: the installation, each update and the uninstall. `install.sh` checks its permissions first. When one is missing, it stops before it changes anything and shows the command that grants the role.
- **Quotas.** The installer asks Google for the quotas of the deployment size by itself, on the first run. Google usually approves the sizes `small` and `medium` in seconds; the size `xlarge` can need a review of 24 to 72 hours. Google sends its answer to the contact email that you give to the installer.

## Steps

#### Variant: AWS

1. **Open the CloudFormation console** in the region where Platforma will run, and choose **Create stack** → **With new resources (standard)**. In **Specify template**, choose **Amazon S3 URL** and paste the template of the last release:

   ```text
   https://platforma-cloudformation.s3.eu-central-1.amazonaws.com/cloudformation-eks-1-35.yaml
   ```

2. **Fill the parameters.** Give the stack a name, for example `platforma`. A first installation needs only these parameters; all others have defaults:

   | Parameter                                                                                                                                                                                  | What it sets                                                                                                                                                                                                                                                                                                                                            | Default                                         |
   | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
   | Domain name (`DomainName`)                                                                                                                                                                 | The domain that users type in the Desktop App                                                                                                                                                                                                                                                                                                           | Necessary                                       |
   | Route53 hosted zone ID (`HostedZoneId`)                                                                                                                                                    | The zone of the domain, for example `Z0123456789ABCDEF`                                                                                                                                                                                                                                                                                                 | Necessary                                       |
   | Platforma license key (`LicenseKey`)                                                                                                                                                       | The license key                                                                                                                                                                                                                                                                                                                                         | Necessary                                       |
   | Deployment size (`DeploymentSize`)                                                                                                                                                         | The largest job and how many jobs run at the same time                                                                                                                                                                                                                                                                                                  | `small`                                         |
   | Google, Entra ID or LDAP parameters                                                                                                                                                        | Sign-in of the users with a sign-in provider                                                                                                                                                                                                                                                                                                            | Empty: only the administrator login `platforma` |
   | Admin logins (`AdminUsers`)                                                                                                                                                                | The logins that get the administrator role (The role in the Backend that can read and change the data of all users and run the pl-cli administrator commands. The operator sets rules that give it to users by login, group or attribute.): regular expressions that must match the whole login, separated with `;`. Escape a dot: `alice@example\.com` | Empty                                           |
   | Enable MiLaboratories demo data library (A folder or bucket with input data of the company. Users select files from it in the Desktop App. Platforma only reads it.) (`EnableDemoLibrary`) | The read-only demo data of MiLaboratories                                                                                                                                                                                                                                                                                                               | `true`                                          |

   The other parameters set, for example, a VPC that exists, a static list of users, the data libraries of the company, GPU nodes and a fixed version of Platforma: see [Stack parameters](/reference-installer-parameters/). For the sign-in providers and the administrator role, see [Authentication](/configuration-authentication/) and [Users and roles](/configuration-users-and-roles/).

3. **Create the stack.** On the last page, accept that the stack makes IAM resources, check the domain, the zone, the license key and the sign-in parameters, and choose **Submit**.

   The stack takes about 20 minutes: it makes the infrastructure, then installs the cluster services and Platforma. Result: the status of the stack is `CREATE_COMPLETE`.

4. **Read the outputs** of the stack, on the tab **Outputs**: `PlatformaUrl` is the address for the Desktop App, and `AdminUsername` and `AdminPasswordSSMConsole` give the administrator login (`platforma`) and a link to its password. For all outputs, see [Stack outputs](/reference-installer-parameters/#outputs-of-the-aws-stack).

   To read the administrator password, open the link of `AdminPasswordSSMConsole` and choose **Show**, or run:

   ```sh
   aws ssm get-parameter --name /<ClusterName>/platforma/admin-password \
     --with-decryption --query Parameter.Value --output text
   ```

5. **Wait for DNS.** The stack writes the DNS record of the domain by itself. The load balancer and the record need 1 to 3 more minutes after the stack is complete. Result: `dig +short platforma.example.com` gives an address.

6. **Verify the installation** (see [Verify the installation](/install-verify/)) and [connect the Desktop App](/install-connect-clients/) with the value of `PlatformaUrl` and the administrator login.

7. **Save the parameters that you chose.** You need them again for each update and upgrade. The stack keeps them: see them on the tab **Parameters** of the stack, or run:

   ```sh
   aws cloudformation describe-stacks --stack-name <stack name> \
     --query 'Stacks[0].Parameters' --output table
   ```

   The stack does not show the values of the secret parameters: it shows `****`. These are `LicenseKey`, `HtpasswdContent`, `LdapSearchPassword`, `GoogleClientSecret`, and the access keys and secret keys of the data libraries. An update keeps them, but keep these values in the secret store of the company.

When the stack stops in `CREATE_IN_PROGRESS` for more than 20 minutes, open Certificate Manager: a certificate in `PENDING_VALIDATION` means a wrong zone ID, or a parent zone that does not delegate to the zone. When the stack fails, the logs of the two CodeBuild projects of the [outputs](/reference-installer-parameters/#outputs-of-the-aws-stack) give the reason.

#### Variant: Google Cloud

1. **Open [Cloud Shell](https://shell.cloud.google.com/)** and select the project:

   ```sh
   gcloud config set project <project>
   ```

   Cloud Shell has all the tools that the installer needs: `gcloud`, `git` and `jq`.

2. **Get the installer** of the last release of `platforma-helm`. The release tags, for example `v5.0.6`, are on the page [Tags](https://github.com/milaboratory/platforma-helm/tags) of the repository. The installer installs the version of Platforma of this release.

   ```sh
   git clone --branch <release tag> https://github.com/milaboratory/platforma-helm.git
   cd platforma-helm/infrastructure/gcp/cloudshell
   ```

   Keep this folder: you use it again to change settings and to upgrade.

3. **Run the installer and answer its questions.**

   ```sh
   bash install.sh
   ```

   The installer checks the project and the Infrastructure Manager permissions of your account (the role `roles/config.admin`). When a permission is missing, it stops before it changes anything and shows the command that grants the role. Then it turns on the APIs that it needs and asks its questions. It also sets the quota project of your Application Default Credentials to the Platforma project. In Cloud Shell, this change applies only to the session. On your own computer, if you use Application Default Credentials for other projects, set the quota project back to your usual project after the install: `gcloud auth application-default set-quota-project <YOUR_PROJECT_ID>`.

   A first installation needs these answers; the other questions have defaults:

   | Question                                                                                                                                                            | Environment variable                                               | Default                                        |
   | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ---------------------------------------------- |
   | Deployment name                                                                                                                                                     | `DEPLOYMENT_NAME`                                                  | `platforma`                                    |
   | GCP region for the cluster                                                                                                                                          | `REGION`                                                           | `europe-west1`                                 |
   | Deployment size                                                                                                                                                     | `DEPLOYMENT_SIZE`                                                  | `small`                                        |
   | Cloud DNS zone and subdomain: the installer lists the zones of the project                                                                                          | `DNS_ZONE_NAME` and `DOMAIN_NAME` (the full domain), both together | Subdomain: the deployment name                 |
   | Platforma license key: the installer checks it with the license service                                                                                             | `LICENSE_KEY`                                                      | Necessary                                      |
   | SSO (Sign-in through the identity service of the company, with the same account as for other company systems.) source, LDAP server URL, your own htpasswd user file | `SSO_PROVIDER`, `LDAP_SERVER`, `ENABLE_LOCAL_USERS`                | None: only the administrator login `platforma` |
   | Admin logins on each sign-in provider that is on                                                                                                                    | `SSO_ADMIN_USERS`, `LDAP_ADMIN_USERS`, `LOCAL_ADMIN_USERS`         | Empty                                          |
   | Enable MiLaboratories demo data library                                                                                                                             | `ENABLE_DEMO`                                                      | `true`                                         |

   To give an answer before you start, set its environment variable, for example `export DEPLOYMENT_SIZE=medium`: the installer then does not ask it. Two pages give all the variables:

   - [Questions of install.sh](/reference-installer-parameters/): all questions.
   - [Variables without a question](/reference-installer-parameters/): the variables of each sign-in provider and of the data libraries of the company, and the settings that the installer does not ask, for example GPU nodes.

   For the sign-in providers and the administrator role, see [Authentication](/configuration-authentication/) and [Users and roles](/configuration-users-and-roles/).

4. **Confirm.** The installer shows all the values and asks `Proceed?`. Answer `y`.

   Before the review, the installer has stored the secrets in Secret Manager. After you confirm, it makes the deployment `<name>-infra`, writes the Kubernetes Secrets of Platforma from Secret Manager, and makes the deployment `<name>-platforma`. It waits for each deployment: about 25 minutes in total. Result: the installer shows `Done.` and the steps to connect.

   Cloud Shell disconnects after about one hour without input, but the deployments continue. To follow them, open Infrastructure Manager and Cloud Build in the Google Cloud console: the installer shows the links. When a deployment fails, its revision in Infrastructure Manager shows the error. After you fix the cause, run `bash install.sh` again with the same answers: it updates the same deployments.

5. **Wait for the certificate.** Google gives it some minutes after the deployment: in tests, 15 to 45 minutes. Until then, the entry point fails with a TLS error. Result: the state is `ACTIVE`.

   ```sh
   gcloud certificate-manager certificates describe <name>-cluster-cert --location=global
   ```

6. **Get the administrator password:**

   ```sh
   gcloud secrets versions access latest --secret=<name>-cluster-admin-password
   ```

   The person who reads the password needs the permission `secretmanager.versions.access` (role `roles/secretmanager.secretAccessor`) in the project. The person who ran `install.sh` has it. To give it to another person on this one secret only:

   ```sh
   gcloud secrets add-iam-policy-binding <name>-cluster-admin-password --project=<PROJECT_ID> --member=user:<EMAIL> --role=roles/secretmanager.secretAccessor
   ```

7. **Verify the installation** (see [Verify the installation](/install-verify/)) and [connect the Desktop App](/install-connect-clients/) to `https://<domain>` with the login `platforma` and this password.

8. **Save the answers that you gave.** `install.sh` does not keep them, and each update and upgrade needs all of them again, with the same `PROJECT_ID`, `DEPLOYMENT_NAME` and `IM_LOCATION`. Write them as environment variables into a file, for example `platforma-answers.sh`:

   ```sh
   export PROJECT_ID=my-project
   export DEPLOYMENT_NAME=platforma
   export DEPLOYMENT_SIZE=small
   export LICENSE_KEY=<license key>
   ```

   Before the next run, load them with `source platforma-answers.sh`. The file holds the license key and the other secret values: keep it in the secret store of the company.

## Maintain an installer installation

To upgrade the installation or to change its settings, run the installer again: see [Update an installer installation](/maintain-updating-cloud-installer/). The other Maintain pages show the steps for the installers in their tabs **AWS installer** and **Google Cloud installer**:

- [Upgrade Platforma](/maintain-upgrading/): the checks before and after an upgrade, and the way back to the old version;
- [Back up and restore](/maintain-backup-and-restore/): what to keep and how to restore it;
- [Migrate between sign-in providers](/maintain-migrating-sign-in-providers/): for example from LDAP to SSO;
- [Uninstall an installer installation](/maintain-uninstalling-cloud-installer/): delete the stack on AWS, run `teardown.sh` on Google Cloud, and delete the data that stays.

## Next

- [Installer parameters](/reference-installer-parameters/)

Source: https://docs.platforma.bio/install-cloud-installer/
