Secret
Reference doc for the `sst.Secret` component.
The Secret
component lets you create secrets in your app.
Secrets are encrypted and stored in an S3 Bucket in your AWS account. If used in your app config, they’ll be encrypted in your state file as well. If used in your function code, they’ll be decrypted and stored in the function package.
Create a secret
Set a placeholder
You can optionally set a placeholder
.
Set the value of the secret
You can then set the value of a secret using the CLI.
Use the secret in your app config
You can now use the secret in your app config.
Link the secret to a resource
You can link the secret to other resources, like a function or your Next.js app.
Once linked, you can use the secret in your function code.
Constructor
Parameters
-
name
string
A placeholder value of the secret. This can be useful for cases where you might not be storing sensitive values.placeholder?
string
Properties
name
Type Output
<
string
>
The name of the secret.
placeholder
Type Output
<
undefined
|
string
>
The placeholder value of the secret.
value
Type Output
<
string
>
The value of the secret. It’ll be undefined
if the secret has not been set through the CLI or if the placeholder
hasn’t been set.
SDK
The following are accessible through the SDK at runtime.
value
Type string
The value of the secret. It’ll be undefined
if the secret has not been set through the CLI or if the placeholder
hasn’t been set.