GetVolume

Use this data source to get information about an EBS volume for use in other resources.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var ebsVolume = Output.Create(Aws.Ebs.GetVolume.InvokeAsync(new Aws.Ebs.GetVolumeArgs
        {
            Filters = 
            {
                new Aws.Ebs.Inputs.GetVolumeFilterArgs
                {
                    Name = "volume-type",
                    Values = 
                    {
                        "gp2",
                    },
                },
                new Aws.Ebs.Inputs.GetVolumeFilterArgs
                {
                    Name = "tag:Name",
                    Values = 
                    {
                        "Example",
                    },
                },
            },
            MostRecent = true,
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ebs"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := true
        _, err := ebs.LookupVolume(ctx, &ebs.LookupVolumeArgs{
            Filters: []ebs.GetVolumeFilter{
                ebs.GetVolumeFilter{
                    Name: "volume-type",
                    Values: []string{
                        "gp2",
                    },
                },
                ebs.GetVolumeFilter{
                    Name: "tag:Name",
                    Values: []string{
                        "Example",
                    },
                },
            },
            MostRecent: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

ebs_volume = aws.ebs.get_volume(filters=[
        {
            "name": "volume-type",
            "values": ["gp2"],
        },
        {
            "name": "tag:Name",
            "values": ["Example"],
        },
    ],
    most_recent=True)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ebsVolume = pulumi.output(aws.ebs.getVolume({
    filters: [
        {
            name: "volume-type",
            values: ["gp2"],
        },
        {
            name: "tag:Name",
            values: ["Example"],
        },
    ],
    mostRecent: true,
}, { async: true }));

Using GetVolume

function getVolume(args: GetVolumeArgs, opts?: InvokeOptions): Promise<GetVolumeResult>
function  get_volume(filters=None, most_recent=None, tags=None, opts=None)
func LookupVolume(ctx *Context, args *LookupVolumeArgs, opts ...InvokeOption) (*LookupVolumeResult, error)

Note: This function is named LookupVolume in the Go SDK.

public static class GetVolume {
    public static Task<GetVolumeResult> InvokeAsync(GetVolumeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filters List<GetVolumeFilterArgs>

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-volumes in the AWS CLI reference][1].

MostRecent bool

If more than one result is returned, use the most recent Volume.

Tags Dictionary<string, string>

A map of tags for the resource.

Filters []GetVolumeFilter

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-volumes in the AWS CLI reference][1].

MostRecent bool

If more than one result is returned, use the most recent Volume.

Tags map[string]string

A map of tags for the resource.

filters GetVolumeFilter[]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-volumes in the AWS CLI reference][1].

mostRecent boolean

If more than one result is returned, use the most recent Volume.

tags {[key: string]: string}

A map of tags for the resource.

filters List[GetVolumeFilter]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-volumes in the AWS CLI reference][1].

most_recent bool

If more than one result is returned, use the most recent Volume.

tags Dict[str, str]

A map of tags for the resource.

GetVolume Result

The following output properties are available:

Arn string

The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).

AvailabilityZone string

The AZ where the EBS volume exists.

Encrypted bool

Whether the disk is encrypted.

Id string

The provider-assigned unique ID for this managed resource.

Iops int

The amount of IOPS for the disk.

KmsKeyId string

The ARN for the KMS encryption key.

MultiAttachEnabled bool

(Optional) Specifies whether Amazon EBS Multi-Attach is enabled.

OutpostArn string

The Amazon Resource Name (ARN) of the Outpost.

Size int

The size of the drive in GiBs.

SnapshotId string

The snapshot_id the EBS volume is based off.

Tags Dictionary<string, string>

A map of tags for the resource.

VolumeId string

The volume ID (e.g. vol-59fcb34e).

VolumeType string

The type of EBS volume.

Filters List<GetVolumeFilter>
MostRecent bool
Arn string

The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).

AvailabilityZone string

The AZ where the EBS volume exists.

Encrypted bool

Whether the disk is encrypted.

Id string

The provider-assigned unique ID for this managed resource.

Iops int

The amount of IOPS for the disk.

KmsKeyId string

The ARN for the KMS encryption key.

MultiAttachEnabled bool

(Optional) Specifies whether Amazon EBS Multi-Attach is enabled.

OutpostArn string

The Amazon Resource Name (ARN) of the Outpost.

Size int

The size of the drive in GiBs.

SnapshotId string

The snapshot_id the EBS volume is based off.

Tags map[string]string

A map of tags for the resource.

VolumeId string

The volume ID (e.g. vol-59fcb34e).

VolumeType string

The type of EBS volume.

Filters []GetVolumeFilter
MostRecent bool
arn string

The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).

availabilityZone string

The AZ where the EBS volume exists.

encrypted boolean

Whether the disk is encrypted.

id string

The provider-assigned unique ID for this managed resource.

iops number

The amount of IOPS for the disk.

kmsKeyId string

The ARN for the KMS encryption key.

multiAttachEnabled boolean

(Optional) Specifies whether Amazon EBS Multi-Attach is enabled.

outpostArn string

The Amazon Resource Name (ARN) of the Outpost.

size number

The size of the drive in GiBs.

snapshotId string

The snapshot_id the EBS volume is based off.

tags {[key: string]: string}

A map of tags for the resource.

volumeId string

The volume ID (e.g. vol-59fcb34e).

volumeType string

The type of EBS volume.

filters GetVolumeFilter[]
mostRecent boolean
arn str

The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).

availability_zone str

The AZ where the EBS volume exists.

encrypted bool

Whether the disk is encrypted.

id str

The provider-assigned unique ID for this managed resource.

iops float

The amount of IOPS for the disk.

kms_key_id str

The ARN for the KMS encryption key.

multi_attach_enabled bool

(Optional) Specifies whether Amazon EBS Multi-Attach is enabled.

outpost_arn str

The Amazon Resource Name (ARN) of the Outpost.

size float

The size of the drive in GiBs.

snapshot_id str

The snapshot_id the EBS volume is based off.

tags Dict[str, str]

A map of tags for the resource.

volume_id str

The volume ID (e.g. vol-59fcb34e).

volume_type str

The type of EBS volume.

filters List[GetVolumeFilter]
most_recent bool

Supporting Types

GetVolumeFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string
Values List<string>
Name string
Values []string
name string
values string[]
name str
values List[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.