Interface KeyProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
KeyProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:20.829Z") @Stability(Stable) public interface KeyProps extends software.amazon.jsii.JsiiSerializable
Construction properties for a KMS Key object.

Example:

 import software.amazon.awscdk.services.kms.*;
 Artifact sourceOutput = new Artifact();
 Bucket targetBucket = new Bucket(this, "MyBucket");
 IKey key = Key.Builder.create(this, "EnvVarEncryptKey")
         .description("sample key")
         .build();
 Pipeline pipeline = new Pipeline(this, "MyPipeline");
 S3DeployAction deployAction = S3DeployAction.Builder.create()
         .actionName("S3Deploy")
         .bucket(targetBucket)
         .input(sourceOutput)
         .encryptionKey(key)
         .build();
 IStage deployStage = pipeline.addStage(StageOptions.builder()
         .stageName("Deploy")
         .actions(List.of(deployAction))
         .build());
 
  • Method Details

    • getAdmins

      @Stability(Stable) @Nullable default List<IPrincipal> getAdmins()
      A list of principals to add as key administrators to the key policy.

      Key administrators have permissions to manage the key (e.g., change permissions, revoke), but do not have permissions to use the key in cryptographic operations (e.g., encrypt, decrypt).

      These principals will be added to the default key policy (if none specified), or to the specified policy (if provided).

      Default: []

    • getAlias

      @Stability(Stable) @Nullable default String getAlias()
      Initial alias to add to the key.

      More aliases can be added later by calling addAlias.

      Default: - No alias is added for the key.

    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
      A description of the key.

      Use a description that helps your users decide whether the key is appropriate for a particular task.

      Default: - No description.

    • getEnabled

      @Stability(Stable) @Nullable default Boolean getEnabled()
      Indicates whether the key is available for use.

      Default: - Key is enabled.

    • getEnableKeyRotation

      @Stability(Stable) @Nullable default Boolean getEnableKeyRotation()
      Indicates whether AWS KMS rotates the key.

      Default: false

    • getKeySpec

      @Stability(Stable) @Nullable default KeySpec getKeySpec()
      The cryptographic configuration of the key. The valid value depends on usage of the key.

      IMPORTANT: If you change this property of an existing key, the existing key is scheduled for deletion and a new key is created with the specified value.

      Default: KeySpec.SYMMETRIC_DEFAULT

    • getKeyUsage

      @Stability(Stable) @Nullable default KeyUsage getKeyUsage()
      The cryptographic operations for which the key can be used.

      IMPORTANT: If you change this property of an existing key, the existing key is scheduled for deletion and a new key is created with the specified value.

      Default: KeyUsage.ENCRYPT_DECRYPT

    • getPendingWindow

      @Stability(Stable) @Nullable default Duration getPendingWindow()
      Specifies the number of days in the waiting period before AWS KMS deletes a CMK that has been removed from a CloudFormation stack.

      When you remove a customer master key (CMK) from a CloudFormation stack, AWS KMS schedules the CMK for deletion and starts the mandatory waiting period. The PendingWindowInDays property determines the length of waiting period. During the waiting period, the key state of CMK is Pending Deletion, which prevents the CMK from being used in cryptographic operations. When the waiting period expires, AWS KMS permanently deletes the CMK.

      Enter a value between 7 and 30 days.

      Default: - 30 days

      See Also:
    • getPolicy

      @Stability(Stable) @Nullable default PolicyDocument getPolicy()
      Custom policy document to attach to the KMS key.

      NOTE - If the @aws-cdk/aws-kms:defaultKeyPolicies feature flag is set (the default for new projects), this policy will override the default key policy and become the only key policy for the key. If the feature flag is not set, this policy will be appended to the default key policy.

      Default: - A policy document with permissions for the account root to administer the key will be created.

    • getRemovalPolicy

      @Stability(Stable) @Nullable default RemovalPolicy getRemovalPolicy()
      Whether the encryption key should be retained when it is removed from the Stack.

      This is useful when one wants to retain access to data that was encrypted with a key that is being retired.

      Default: RemovalPolicy.Retain

    • getRotationPeriod

      @Stability(Stable) @Nullable default Duration getRotationPeriod()
      The period between each automatic rotation.

      Default: - set by CFN to 365 days.

    • builder

      @Stability(Stable) static KeyProps.Builder builder()
      Returns:
      a KeyProps.Builder of KeyProps