KeyGroupProps Struct
Properties for creating a Public Key.
| Source | aws-cloudfront/lib/key-group.ts |
|---|---|
| Type last changed |
Example
ts
// Validating signed URLs or signed cookies with Trusted Key Groups
// public key in PEM format
declare const publicKey: string;
const pubKey = new cloudfront.PublicKey(this, 'MyPubKey', {
encodedKey: publicKey,
});
const keyGroup = new cloudfront.KeyGroup(this, 'MyKeyGroup', {
items: [
pubKey,
],
});
new cloudfront.Distribution(this, 'Dist', {
defaultBehavior: {
origin: new origins.HttpOrigin('www.example.com'),
trustedKeyGroups: [
keyGroup,
],
},
});
python
# Validating signed URLs or signed cookies with Trusted Key Groups
# public key in PEM format
# public_key: str
pub_key = cloudfront.PublicKey(self, "MyPubKey",
encoded_key=public_key
)
key_group = cloudfront.KeyGroup(self, "MyKeyGroup",
items=[pub_key
]
)
cloudfront.Distribution(self, "Dist",
default_behavior=cloudfront.BehaviorOptions(
origin=origins.HttpOrigin("www.example.com"),
trusted_key_groups=[key_group
]
)
)
java
// Validating signed URLs or signed cookies with Trusted Key Groups
// public key in PEM format
String publicKey;
PublicKey pubKey = PublicKey.Builder.create(this, "MyPubKey")
.encodedKey(publicKey)
.build();
KeyGroup keyGroup = KeyGroup.Builder.create(this, "MyKeyGroup")
.items(List.of(pubKey))
.build();
Distribution.Builder.create(this, "Dist")
.defaultBehavior(BehaviorOptions.builder()
.origin(new HttpOrigin("www.example.com"))
.trustedKeyGroups(List.of(keyGroup))
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Validating signed URLs or signed cookies with Trusted Key Groups
// public key in PEM format
string publicKey;
var pubKey = new PublicKey(this, "MyPubKey", new PublicKeyProps {
EncodedKey = publicKey
});
var keyGroup = new KeyGroup(this, "MyKeyGroup", new KeyGroupProps {
Items = new [] { pubKey }
});
new Distribution(this, "Dist", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = new HttpOrigin("www.example.com"),
TrustedKeyGroups = new [] { keyGroup }
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Validating signed URLs or signed cookies with Trusted Key Groups
// public key in PEM format
var publicKey string
pubKey := cloudfront.NewPublicKey(this, jsii.String("MyPubKey"), &PublicKeyProps{
EncodedKey: publicKey,
})
keyGroup := cloudfront.NewKeyGroup(this, jsii.String("MyKeyGroup"), &KeyGroupProps{
Items: []IPublicKeyRef{
pubKey,
},
})
cloudfront.NewDistribution(this, jsii.String("Dist"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.NewHttpOrigin(jsii.String("www.example.com")),
TrustedKeyGroups: []IKeyGroupRef{
keyGroup,
},
},
})
Properties
commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #A comment to describe the key group.
Default: no comment
itemsIPublicKeyRef[]itemstyping.List[IPublicKeyRef]itemsList<IPublicKeyRef>ItemsIPublicKeyRef[]Items*[]IPublicKeyRef required #A list of public keys to add to the key group.
keyGroupNameoptionalstringkey_group_nameoptionalstrkeyGroupNameoptionalStringKeyGroupNameoptionalstringKeyGroupNameoptional*string #A name to identify the key group.
Default: generated from the id