aws logo
AWS Classic v5.33.0, Mar 24 23

aws.ebs.DefaultKmsKey

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

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ebs.DefaultKmsKey("example", new()
    {
        KeyArn = aws_kms_key.Example.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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(aws_kms_key.Example.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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(aws_kms_key.example().arn())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.ebs.DefaultKmsKey("example", key_arn=aws_kms_key["example"]["arn"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ebs.DefaultKmsKey("example", {keyArn: aws_kms_key.example.arn});
resources:
  example:
    type: aws:ebs:DefaultKmsKey
    properties:
      keyArn: ${aws_kms_key.example.arn}

Create DefaultKmsKey Resource

new DefaultKmsKey(name: string, args: DefaultKmsKeyArgs, opts?: CustomResourceOptions);
@overload
def DefaultKmsKey(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  key_arn: Optional[str] = None)
@overload
def DefaultKmsKey(resource_name: str,
                  args: DefaultKmsKeyArgs,
                  opts: Optional[ResourceOptions] = 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.

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.

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

The EBS default KMS CMK can be imported with the KMS key ARN, e.g., console

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.