Skip to content
v2.277.0

PublicKeyProps Struct ​

Properties for creating a Public Key.

Example ​

ts
// Create a key group to use with CloudFront signed URLs and signed cookies.
new cloudfront.KeyGroup(this, 'MyKeyGroup', {
  items: [
    new cloudfront.PublicKey(this, 'MyPublicKey', {
      encodedKey: '...', // contents of public_key.pem file
      // comment: 'Key is expiring on ...',
    }),
  ],
  // comment: 'Key group containing public keys ...',
});
python
# Create a key group to use with CloudFront signed URLs and signed cookies.
cloudfront.KeyGroup(self, "MyKeyGroup",
    items=[
        cloudfront.PublicKey(self, "MyPublicKey",
            encoded_key="..."
        )
    ]
)
java
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
KeyGroup.Builder.create(this, "MyKeyGroup")
        .items(List.of(
            PublicKey.Builder.create(this, "MyPublicKey")
                    .encodedKey("...")
                    .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
new KeyGroup(this, "MyKeyGroup", new KeyGroupProps {
    Items = new [] {
        new PublicKey(this, "MyPublicKey", new PublicKeyProps {
            EncodedKey = "..."
        }) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create a key group to use with CloudFront signed URLs and signed cookies.
// Create a key group to use with CloudFront signed URLs and signed cookies.
cloudfront.NewKeyGroup(this, jsii.String("MyKeyGroup"), &KeyGroupProps{
	Items: []IPublicKeyRef{
		cloudfront.NewPublicKey(this, jsii.String("MyPublicKey"), &PublicKeyProps{
			EncodedKey: jsii.String("..."),
		}),
	},
})

Properties ​

commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #
A comment to describe the public key.

Default: no comment

encodedKeystringencoded_keystrencodedKeyStringEncodedKeystringEncodedKey*string required #
The public key that you can use with signed URLs and signed cookies, or with field-level encryption.

The encodedKey parameter must include -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines.

publicKeyNameoptionalstringpublic_key_nameoptionalstrpublicKeyNameoptionalStringPublicKeyNameoptionalstringPublicKeyNameoptional*string #
A name to identify the public key.

Default: generated from the id