Skip to main content
Version: Unreleased 🚧

Common TypeInstances

This document lists all TypeInstances, which are commonly used across our examples. One of common use case is usage of cloud provider services. For example, to use managed database such as AWS RDS or Google Cloud SQL, you need to create TypeInstances which stores required credentials.

Prerequisites

AWS Credentials

  1. Create a new User in AWS dashboard:

    • Grant the proper permissions. You can use the predefined AdministratorAccess permission policy or use your own.
    • Note the access key and secret key.
  2. Create a file with the AWS Credentials:

    AWS_ACCESS_KEY_ID="{AWS access key ID}"
    AWS_SECRET_ACCESS_KEY="{AWS secret access key}"
    cat > /tmp/aws-ti.yaml << ENDOFFILE
    typeInstances:
    - alias: aws-credentials
    attributes:
    - path: cap.attribute.cloud.provider.aws
    revision: 0.1.0
    typeRef:
    path: cap.type.aws.auth.credentials
    revision: 0.1.0
    value:
    accessKeyID: ${AWS_ACCESS_KEY_ID}
    secretAccessKey: ${AWS_SECRET_ACCESS_KEY}
    ENDOFFILE
  3. Create AWS Credentials TypeInstance:

    capact typeinstance create -f /tmp/aws-ti.yaml -ojson
  4. Note the ID.

GCP Service Account

  1. Create a GCP Service Account JSON access key:

    1. Open GCP Console and select your project.

    2. In the left pane, go to IAM & Admin and select Service accounts.

    3. Click Create service account, name your account, and click Create.

    4. Click Create key and choose JSON as the key type.

    5. Save the JSON file under the /tmp/gcp-sa.json path.

    6. Click Done.

  2. Create a file with the GCP Credentials:

    export GCP_SA_VALUE=$(cat /tmp/gcp-sa.json | jq -c)
    cat > /tmp/gcp-sa-ti.yaml << ENDOFFILE
    typeInstances:
    - alias: gcp-sa
    typeRef:
    path: cap.type.gcp.auth.service-account
    revision: 0.1.0
    attributes:
    - path: cap.attribute.cloud.provider.gcp
    revision: 0.1.0
    value: ${GCP_SA_VALUE}
    ENDOFFILE
  3. Create GCP Service Account TypeInstance:

    capact typeinstance create -f /tmp/gcp-sa-ti.yaml -ojson
  4. Note the ID.

Next steps

To see how to use created TypeInstances, check out our Mattermost example.