PublicKeyProps

class aws_cdk.aws_cloudfront.PublicKeyProps(*, encoded_key, comment=None, public_key_name=None)

Bases: object

Properties for creating a Public Key.

Parameters
  • encoded_key (str) – 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.

  • comment (Optional[str]) – A comment to describe the public key. Default: - no comment

  • public_key_name (Optional[str]) – A name to identify the public key. Default: - generated from the id

ExampleMetadata

infused

Example:

# 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
        ]
    )
)

Attributes

comment

A comment to describe the public key.

Default
  • no comment

Return type

Optional[str]

encoded_key

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.

See

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/field-level-encryption.html

Return type

str

public_key_name

A name to identify the public key.

Default
  • generated from the id

Return type

Optional[str]