1. Packages
  2. AWS Classic
  3. API Docs
  4. ebs
  5. DefaultKmsKey

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

aws.ebs.DefaultKmsKey

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

    Provides a resource to manage the default customer master key (CMK) that your AWS account uses to encrypt EBS volumes.

    Your AWS account has an AWS-managed default CMK that is used for encrypting an EBS volume when no CMK is specified in the API call that creates the volume. By using the aws.ebs.DefaultKmsKey resource, you can specify a customer-managed CMK to use in place of the AWS-managed default CMK.

    NOTE: Creating an aws.ebs.DefaultKmsKey resource does not enable default EBS encryption. Use the aws.ebs.EncryptionByDefault to enable default EBS encryption.

    NOTE: Destroying this resource will reset the default CMK to the account’s AWS-managed default CMK for EBS.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ebs.DefaultKmsKey("example", {keyArn: exampleAwsKmsKey.arn});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ebs.DefaultKmsKey("example", key_arn=example_aws_kms_key["arn"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ebs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ebs.NewDefaultKmsKey(ctx, "example", &ebs.DefaultKmsKeyArgs{
    			KeyArn: pulumi.Any(exampleAwsKmsKey.Arn),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Ebs.DefaultKmsKey("example", new()
        {
            KeyArn = exampleAwsKmsKey.Arn,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ebs.DefaultKmsKey;
    import com.pulumi.aws.ebs.DefaultKmsKeyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new DefaultKmsKey("example", DefaultKmsKeyArgs.builder()
                .keyArn(exampleAwsKmsKey.arn())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ebs:DefaultKmsKey
        properties:
          keyArn: ${exampleAwsKmsKey.arn}
    

    Create DefaultKmsKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DefaultKmsKey(name: string, args: DefaultKmsKeyArgs, opts?: CustomResourceOptions);
    @overload
    def DefaultKmsKey(resource_name: str,
                      args: DefaultKmsKeyArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def DefaultKmsKey(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      key_arn: Optional[str] = None)
    func NewDefaultKmsKey(ctx *Context, name string, args DefaultKmsKeyArgs, opts ...ResourceOption) (*DefaultKmsKey, error)
    public DefaultKmsKey(string name, DefaultKmsKeyArgs args, CustomResourceOptions? opts = null)
    public DefaultKmsKey(String name, DefaultKmsKeyArgs args)
    public DefaultKmsKey(String name, DefaultKmsKeyArgs args, CustomResourceOptions options)
    
    type: aws:ebs:DefaultKmsKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DefaultKmsKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args DefaultKmsKeyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args DefaultKmsKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DefaultKmsKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DefaultKmsKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var defaultKmsKeyResource = new Aws.Ebs.DefaultKmsKey("defaultKmsKeyResource", new()
    {
        KeyArn = "string",
    });
    
    example, err := ebs.NewDefaultKmsKey(ctx, "defaultKmsKeyResource", &ebs.DefaultKmsKeyArgs{
    	KeyArn: pulumi.String("string"),
    })
    
    var defaultKmsKeyResource = new DefaultKmsKey("defaultKmsKeyResource", DefaultKmsKeyArgs.builder()
        .keyArn("string")
        .build());
    
    default_kms_key_resource = aws.ebs.DefaultKmsKey("defaultKmsKeyResource", key_arn="string")
    
    const defaultKmsKeyResource = new aws.ebs.DefaultKmsKey("defaultKmsKeyResource", {keyArn: "string"});
    
    type: aws:ebs:DefaultKmsKey
    properties:
        keyArn: string
    

    DefaultKmsKey Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The DefaultKmsKey resource accepts the following input properties:

    KeyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    KeyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn String
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    key_arn str
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn String
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DefaultKmsKey resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DefaultKmsKey Resource

    Get an existing DefaultKmsKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: DefaultKmsKeyState, opts?: CustomResourceOptions): DefaultKmsKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            key_arn: Optional[str] = None) -> DefaultKmsKey
    func GetDefaultKmsKey(ctx *Context, name string, id IDInput, state *DefaultKmsKeyState, opts ...ResourceOption) (*DefaultKmsKey, error)
    public static DefaultKmsKey Get(string name, Input<string> id, DefaultKmsKeyState? state, CustomResourceOptions? opts = null)
    public static DefaultKmsKey get(String name, Output<String> id, DefaultKmsKeyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    KeyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    KeyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn String
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn string
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    key_arn str
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.
    keyArn String
    The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume.

    Import

    Using pulumi import, import the EBS default KMS CMK using the KMS key ARN. For example:

    $ pulumi import aws:ebs/defaultKmsKey:DefaultKmsKey example arn:aws:kms:us-east-1:123456789012:key/abcd-1234
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi