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
- Capact CLI installed.
- Cluster with Capact installation. See the installation tutorial.
jq
installed.
AWS Credentials
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.
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}
ENDOFFILECreate AWS Credentials TypeInstance:
capact typeinstance create -f /tmp/aws-ti.yaml -ojson
Note the ID.
GCP Service Account
Create a GCP Service Account JSON access key:
Open GCP Console and select your project.
In the left pane, go to IAM & Admin and select Service accounts.
Click Create service account, name your account, and click Create.
Click Create key and choose
JSON
as the key type.Save the
JSON
file under the/tmp/gcp-sa.json
path.Click Done.
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}
ENDOFFILECreate GCP Service Account TypeInstance:
capact typeinstance create -f /tmp/gcp-sa-ti.yaml -ojson
Note the ID.
Next steps
To see how to use created TypeInstances, check out our Mattermost example.