SecretProps Struct
The properties required to create a new secret in AWS Secrets Manager.
Example
const user = new iam.User(this, 'User');
const accessKey = new iam.AccessKey(this, 'AccessKey', { user });
declare const stack: Stack;
new secretsmanager.Secret(this, 'Secret', {
secretObjectValue: {
username: SecretValue.unsafePlainText(user.userName),
database: SecretValue.unsafePlainText('foo'),
password: accessKey.secretAccessKey,
},
})
Properties
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#Default: No description.
encryptionKeyoptionalIKeyencryption_keyoptionalIKeyencryptionKeyoptionalIKeyEncryptionKeyoptionalIKeyEncryptionKeyoptionalIKey#Default: A default KMS key for the account and region is used.
generateSecretStringoptionalSecretStringGeneratorgenerate_secret_stringoptionalSecretStringGeneratorgenerateSecretStringoptionalSecretStringGeneratorGenerateSecretStringoptionalSecretStringGeneratorGenerateSecretStringoptionalSecretStringGenerator#Default: 32 characters with upper-case letters, lower-case letters, punctuation and numbers (at least one from each category), per the default values of SecretStringGenerator.
Only one of secretString and generateSecretString can be provided.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy#Default: Not set.
replicaRegionsoptionalReplicaRegion[]replica_regionsoptionaltyping.List[ReplicaRegion]replicaRegionsoptionalList<ReplicaRegion>ReplicaRegionsoptionalReplicaRegion[]ReplicaRegionsoptional*[]ReplicaRegion#Default: Secret is not replicated
secretNameoptionalstringsecret_nameoptionalstrsecretNameoptionalStringSecretNameoptionalstringSecretNameoptional*string#Default: A name is generated by CloudFormation.
Note that deleting secrets from SecretsManager does not happen immediately, but after a 7 to 30 days blackout period. During that period, it is not possible to create another secret that shares the same name.
secretObjectValueoptional{ [key: string]: SecretValue }secret_object_valueoptionaltyping.Mapping[str, SecretValue]secretObjectValueoptionalMap<String, SecretValue>SecretObjectValueoptionalIDictionary<string, SecretValue>SecretObjectValueoptional*map[string]SecretValue#Default: SecretsManager generates a new secret value.
notes · example
NOTE: *It is highly encouraged to leave this field undefined and allow SecretsManager to create the secret value. The secret object -- if provided -- will be included in the output of the cdk as part of synthesis, and will appear in the CloudFormation template in the console. This can be secure(-ish) if that value is merely reference to another resource (or one of its attributes), but if the value is a plaintext string, it will be visible to anyone with access to the CloudFormation template (via the AWS Console, SDKs, or CLI).
Specifies a JSON object that you want to encrypt and store in this new version of the secret. To specify a simple string value instead, use SecretProps.secretStringValue
Only one of secretStringBeta1, secretStringValue, 'secretObjectValue', and generateSecretString can be provided.
declare const user: iam.User;
declare const accessKey: iam.AccessKey;
declare const stack: Stack;
new secretsmanager.Secret(stack, 'JSONSecret', {
secretObjectValue: {
username: SecretValue.unsafePlainText(user.userName), // intrinsic reference, not exposed as plaintext
database: SecretValue.unsafePlainText('foo'), // rendered as plain text, but not a secret
password: accessKey.secretAccessKey, // SecretValue
},
});
secretStringBeta1optionalSecretStringValueBeta1secret_string_beta1optionalSecretStringValueBeta1secretStringBeta1optionalSecretStringValueBeta1SecretStringBeta1optionalSecretStringValueBeta1SecretStringBeta1optionalSecretStringValueBeta1deprecated#Default: SecretsManager generates a new secret value.
notes
NOTE: *It is highly encouraged to leave this field undefined and allow SecretsManager to create the secret value. The secret string -- if provided -- will be included in the output of the cdk as part of synthesis, and will appear in the CloudFormation template in the console. This can be secure(-ish) if that value is merely reference to another resource (or one of its attributes), but if the value is a plaintext string, it will be visible to anyone with access to the CloudFormation template (via the AWS Console, SDKs, or CLI).
Specifies text data that you want to encrypt and store in this new version of the secret. May be a simple string value, or a string representation of a JSON structure.
Only one of secretStringBeta1, secretStringValue, and generateSecretString can be provided.
secretStringValueoptionalSecretValuesecret_string_valueoptionalSecretValuesecretStringValueoptionalSecretValueSecretStringValueoptionalSecretValueSecretStringValueoptionalSecretValue#Default: SecretsManager generates a new secret value.
notes
NOTE: *It is highly encouraged to leave this field undefined and allow SecretsManager to create the secret value. The secret string -- if provided -- will be included in the output of the cdk as part of synthesis, and will appear in the CloudFormation template in the console. This can be secure(-ish) if that value is merely reference to another resource (or one of its attributes), but if the value is a plaintext string, it will be visible to anyone with access to the CloudFormation template (via the AWS Console, SDKs, or CLI).
Specifies text data that you want to encrypt and store in this new version of the secret. May be a simple string value. To provide a string representation of JSON structure, use SecretProps.secretObjectValue instead.
Only one of secretStringBeta1, secretStringValue, 'secretObjectValue', and generateSecretString can be provided.