Skip to content
v2.275.0

PrivateCertificate L2 construct ​

A private certificate managed by AWS Certificate Manager.

Example ​

ts
import * as acmpca from 'aws-cdk-lib/aws-acmpca';

new acm.PrivateCertificate(this, 'PrivateCertificate', {
  domainName: 'test.example.com',
  subjectAlternativeNames: ['cool.example.com', 'test.example.net'], // optional
  certificateAuthority: acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CA',
    'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77'),
  keyAlgorithm: acm.KeyAlgorithm.RSA_2048, // optional, default algorithm is RSA_2048
});
python
import aws_cdk.aws_acmpca as acmpca


acm.PrivateCertificate(self, "PrivateCertificate",
    domain_name="test.example.com",
    subject_alternative_names=["cool.example.com", "test.example.net"],  # optional
    certificate_authority=acmpca.CertificateAuthority.from_certificate_authority_arn(self, "CA", "arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77"),
    key_algorithm=acm.KeyAlgorithm.RSA_2048
)
java
import software.amazon.awscdk.services.acmpca.*;


PrivateCertificate.Builder.create(this, "PrivateCertificate")
        .domainName("test.example.com")
        .subjectAlternativeNames(List.of("cool.example.com", "test.example.net")) // optional
        .certificateAuthority(CertificateAuthority.fromCertificateAuthorityArn(this, "CA", "arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77"))
        .keyAlgorithm(KeyAlgorithm.RSA_2048)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.ACMPCA;


new PrivateCertificate(this, "PrivateCertificate", new PrivateCertificateProps {
    DomainName = "test.example.com",
    SubjectAlternativeNames = new [] { "cool.example.com", "test.example.net" },  // optional
    CertificateAuthority = CertificateAuthority.FromCertificateAuthorityArn(this, "CA", "arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77"),
    KeyAlgorithm = KeyAlgorithm.RSA_2048
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import acmpca "github.com/aws/aws-cdk-go/awscdk"


acm.NewPrivateCertificate(this, jsii.String("PrivateCertificate"), &PrivateCertificateProps{
	DomainName: jsii.String("test.example.com"),
	SubjectAlternativeNames: []*string{
		jsii.String("cool.example.com"),
		jsii.String("test.example.net"),
	},
	 // optional
	CertificateAuthority: acmpca.CertificateAuthority_FromCertificateAuthorityArn(this, jsii.String("CA"), jsii.String("arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77")),
	KeyAlgorithm: acm.KeyAlgorithm_RSA_2048(),
})

Initializer ​

ts
new PrivateCertificate(scope: Construct, id: string, props: PrivateCertificateProps)
python
PrivateCertificate(scope: Construct, id: str, props: PrivateCertificateProps)
java
new PrivateCertificate(Construct scope, String id, PrivateCertificateProps props)
csharp
new PrivateCertificate(Construct scope, string id, PrivateCertificateProps props)
go
NewPrivateCertificate(Scope Construct, Id *string, Props PrivateCertificateProps)

Construct Props ​

allowExportoptionalbooleanallow_exportoptionalboolallowExportoptionalBooleanAllowExportoptionalboolAllowExportoptional*bool= false#
Enable or disable export of this certificate.

If you issue an exportable public certificate, there is a charge at certificate issuance and again when the certificate renews. Ref: https://aws.amazon.com/certificate-manager/pricing

certificateAuthorityICertificateAuthorityRefcertificate_authorityICertificateAuthorityRefcertificateAuthorityICertificateAuthorityRefCertificateAuthorityICertificateAuthorityRefCertificateAuthorityICertificateAuthorityRefrequired#
Private certificate authority (CA) that will be used to issue the certificate.
domainNamestringdomain_namestrdomainNameStringDomainNamestringDomainName*stringrequired#
Fully-qualified domain name to request a private certificate for.

May contain wildcards, such as *.domain.com.

keyAlgorithmoptionalKeyAlgorithmkey_algorithmoptionalKeyAlgorithmkeyAlgorithmoptionalKeyAlgorithmKeyAlgorithmoptionalKeyAlgorithmKeyAlgorithmoptionalKeyAlgorithm= KeyAlgorithm.RSA_2048#
Specifies the algorithm of the public and private key pair that your certificate uses to encrypt data.

When you request a private PKI certificate signed by a CA from AWS Private CA, the specified signing algorithm family (RSA or ECDSA) must match the algorithm family of the CA's secret key.

subjectAlternativeNamesoptionalstring[]subject_alternative_namesoptionaltyping.List[str]subjectAlternativeNamesoptionalList<String>SubjectAlternativeNamesoptionalstring[]SubjectAlternativeNamesoptional*[]*string#
Alternative domain names on your private certificate.

Default: No additional FQDNs will be included as alternative domain names.

Use this to register alternative domain names that represent the same site.

Properties ​

certificateArnstringcertificate_arnstrcertificateArnStringCertificateArnstringCertificateArn*string#
The certificate's ARN.
certificateRefCertificateReferencecertificate_refCertificateReferencecertificateRefCertificateReferenceCertificateRefCertificateReferenceCertificateRefCertificateReference#
A reference to a Certificate resource.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

fromCertificateArn(scope: Construct, id: string, certificateArn: string): ICertificate@staticmethod def from_certificate_arn(scope: Construct, id: str, certificate_arn: str) -> ICertificatepublic static ICertificate fromCertificateArn(Construct scope, String id, String certificateArn)public static ICertificate FromCertificateArn(Construct scope, string id, string certificateArn)func FromCertificateArn(Scope Construct, Id *string, CertificateArn *string) ICertificatestatic#
Import a certificate.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
metricDaysToExpiry(props?: MetricOptions): Metricdef metric_days_to_expiry(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricDaysToExpiry(MetricOptions props)public Metric MetricDaysToExpiry(MetricOptions? props = null)func MetricDaysToExpiry(Props MetricOptions) Metric#
Return the DaysToExpiry metric for this AWS Certificate Manager Certificate. By default, this is the minimum value over 1 day.

This metric is no longer emitted once the certificate has effectively expired, so alarms configured on this metric should probably treat missing data as "breaching".

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.