Class CfnSecret
Creates a new secret.
Inherited Members
Namespace: Amazon.CDK.AWS.SecretsManager
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnSecret : CfnResource, IInspectable, ITaggable
Syntax (vb)
Public Class CfnSecret
Inherits CfnResource
Implements IInspectable, ITaggable
Remarks
A secret can be a password, a set of credentials such as a user name and password, an OAuth token, or other secret information that you store in an encrypted form in Secrets Manager.
For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .
To retrieve a secret in a CloudFormation template, use a dynamic reference . For more information, see Retrieve a secret in an AWS CloudFormation resource .
A common scenario is to first create a secret with GenerateSecretString
, which generates a password, and then use a dynamic reference to retrieve the username and password from the secret to use as credentials for a new database. See the example Creating a Redshift cluster and a secret for the admin credentials .
For information about creating a secret in the console, see Create a secret . For information about creating a secret using the CLI or SDK, see CreateSecret .
For information about retrieving a secret in code, see Retrieve secrets from Secrets Manager .
CloudformationResource: AWS::SecretsManager::Secret
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.SecretsManager;
var cfnSecret = new CfnSecret(this, "MyCfnSecret", new CfnSecretProps {
Description = "description",
GenerateSecretString = new GenerateSecretStringProperty {
ExcludeCharacters = "excludeCharacters",
ExcludeLowercase = false,
ExcludeNumbers = false,
ExcludePunctuation = false,
ExcludeUppercase = false,
GenerateStringKey = "generateStringKey",
IncludeSpace = false,
PasswordLength = 123,
RequireEachIncludedType = false,
SecretStringTemplate = "secretStringTemplate"
},
KmsKeyId = "kmsKeyId",
Name = "name",
ReplicaRegions = new [] { new ReplicaRegionProperty {
Region = "region",
// the properties below are optional
KmsKeyId = "kmsKeyId"
} },
SecretString = "secretString",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
});
Synopsis
Constructors
CfnSecret(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnSecret(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnSecret(Construct, String, ICfnSecretProps) |
Properties
AttrId | The ARN of the secret. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
Description | The description of the secret. |
GenerateSecretString | A structure that specifies how to generate a password to encrypt and store in the secret. |
KmsKeyId | The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret. |
Name | The name of the new secret. |
ReplicaRegions | A custom type that specifies a |
SecretString | The text to encrypt and store in the secret. |
Tags | Tag Manager which manages the tags for this resource. |
TagsRaw | A list of tags to attach to the secret. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnSecret(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnSecret(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnSecret(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnSecret(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnSecret(Construct, String, ICfnSecretProps)
public CfnSecret(Construct scope, string id, ICfnSecretProps props = null)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnSecretProps
Resource properties.
Properties
AttrId
The ARN of the secret.
public virtual string AttrId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Id
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
Description
The description of the secret.
public virtual string Description { get; set; }
Property Value
System.String
GenerateSecretString
A structure that specifies how to generate a password to encrypt and store in the secret.
public virtual object GenerateSecretString { get; set; }
Property Value
System.Object
KmsKeyId
The ARN, key ID, or alias of the AWS KMS key that Secrets Manager uses to encrypt the secret value in the secret.
public virtual string KmsKeyId { get; set; }
Property Value
System.String
Name
The name of the new secret.
public virtual string Name { get; set; }
Property Value
System.String
ReplicaRegions
A custom type that specifies a Region
and the KmsKeyId
for a replica secret.
public virtual object ReplicaRegions { get; set; }
Property Value
System.Object
SecretString
The text to encrypt and store in the secret.
public virtual string SecretString { get; set; }
Property Value
System.String
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
TagsRaw
A list of tags to attach to the secret.
public virtual ICfnTag[] TagsRaw { get; set; }
Property Value
ICfnTag[]
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>