Manage secrets

Akka Serverless provides secret management for each project. Secrets are for passwords, login credentials, keys, etc. You can provide secrets to your services through environment variables. When you display the service information, the content of the secrets will not displayed.

Manage secrets in a project

Adding secrets

To add secrets to your Akka Serverless project, you can use the Akka Serverless CLI.

When you create a secret, it contains: - secret name - contents (as key/value pairs)

CLI

Use the akkasls secret create command.

akkasls secret create generic db_secret \ (1)
  --literal username=admin,pwd=my_passwd (2)
1 Secret name
2 Contents (as key/value pairs)

Listing secrets

To list the secrets in your Akka Serverless project, you can use the Akka Serverless CLI or the Akka Serverless Console. For security purposes, they only show content keys. Neither the CLI nor the Console will show content values of a secret.

CLI

Use the akkasls secret list command:

akkasls secret list

The results should look something like:

NAME         TYPE      KEYS
db_secret    generic   username,pwd

+ Console::

+ . Sign in to your Akka Serverless account at: https://console.akkaserverless.com/ . Click the project for which you want to see the secrets. . Using the left pane or top navigation bar, click Secrets to open the Secrets page which lists the secrets.

Display secret contents

To display secret contents for your Akka Serverless project, you can use the Akka Serverless CLI or the Akka Serverless Console. For security purposes, they only show content keys. Neither the CLI nor the Console will show content values of a secret.

CLI

Use the akkasls secret get command:

akkasls secret get <secret-name>

The results should look something like:

NAME: db_secret
KEYS:
   username
   pwd
Console
  1. Sign in to your Akka Serverless account at: https://console.akkaserverless.com/

  2. Click the project for which you want to see the secrets.

  3. Using the left pane or top navigation bar, click Secrets to open the Secrets page which lists the secrets.

  4. Click the secret you wish to review.

Removing secrets

To remove the secret for your Akka Serverless project, you can use the Akka Serverless CLI.

CLI

akkasls secret delete command:

akkasls secret delete <secret-name>

Set secrets as environment variables for a service

To set secrets as environment variables for a service, you can use the Akka Serverless CLI.

CLI

akkasls service deploy command with parameter --secret-env:

akkasls service deploy <service-name> <container-image>  \
    --secret-env MY_VAR1=db_secret/username,MY_VAR2=db_secret/pwd  (1)
1 The value for an environment variable that refers to a secret is of the form <secret-name>/<secret-key>

Display secrets as environment variables for a service

To set secrets as environment variables for a service, you can use the Akka Serverless CLI or the Akka Serverless Console.

CLI

akkasls service get:

akkasls service get <service-name>

The results should look something like:

Service: 	<service-name>
Created: 	24s
Description:
Status: 	Running
Image: 		<container-image-path>
Env variables:
		MY_VAR1=db_secret/username
		MY_VAR2=db_secret/pwd

Generation: 	1
Store: 		<store-name>
Console
  1. Sign in to your Akka Serverless account at: https://console.akkaserverless.com/

  2. Click the project to which your service belongs.

  3. Click the service.

  4. In the Properties: <service-name> panel, you should see the environment variables.