AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi
aws.ebs.getVolume
Explore with Pulumi AI
Use this data source to get information about an EBS volume for use in other resources.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ebsVolume = aws.ebs.getVolume({
    mostRecent: true,
    filters: [
        {
            name: "volume-type",
            values: ["gp2"],
        },
        {
            name: "tag:Name",
            values: ["Example"],
        },
    ],
});
import pulumi
import pulumi_aws as aws
ebs_volume = aws.ebs.get_volume(most_recent=True,
    filters=[
        {
            "name": "volume-type",
            "values": ["gp2"],
        },
        {
            "name": "tag:Name",
            "values": ["Example"],
        },
    ])
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.LookupVolume(ctx, &ebs.LookupVolumeArgs{
			MostRecent: pulumi.BoolRef(true),
			Filters: []ebs.GetVolumeFilter{
				{
					Name: "volume-type",
					Values: []string{
						"gp2",
					},
				},
				{
					Name: "tag:Name",
					Values: []string{
						"Example",
					},
				},
			},
		}, nil)
		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 ebsVolume = Aws.Ebs.GetVolume.Invoke(new()
    {
        MostRecent = true,
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetVolumeFilterInputArgs
            {
                Name = "volume-type",
                Values = new[]
                {
                    "gp2",
                },
            },
            new Aws.Ebs.Inputs.GetVolumeFilterInputArgs
            {
                Name = "tag:Name",
                Values = new[]
                {
                    "Example",
                },
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ebs.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetVolumeArgs;
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) {
        final var ebsVolume = EbsFunctions.getVolume(GetVolumeArgs.builder()
            .mostRecent(true)
            .filters(            
                GetVolumeFilterArgs.builder()
                    .name("volume-type")
                    .values("gp2")
                    .build(),
                GetVolumeFilterArgs.builder()
                    .name("tag:Name")
                    .values("Example")
                    .build())
            .build());
    }
}
variables:
  ebsVolume:
    fn::invoke:
      function: aws:ebs:getVolume
      arguments:
        mostRecent: true
        filters:
          - name: volume-type
            values:
              - gp2
          - name: tag:Name
            values:
              - Example
Using getVolume
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVolume(args: GetVolumeArgs, opts?: InvokeOptions): Promise<GetVolumeResult>
function getVolumeOutput(args: GetVolumeOutputArgs, opts?: InvokeOptions): Output<GetVolumeResult>def get_volume(filters: Optional[Sequence[GetVolumeFilter]] = None,
               most_recent: Optional[bool] = None,
               tags: Optional[Mapping[str, str]] = None,
               opts: Optional[InvokeOptions] = None) -> GetVolumeResult
def get_volume_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVolumeFilterArgs]]]] = None,
               most_recent: Optional[pulumi.Input[bool]] = None,
               tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetVolumeResult]func LookupVolume(ctx *Context, args *LookupVolumeArgs, opts ...InvokeOption) (*LookupVolumeResult, error)
func LookupVolumeOutput(ctx *Context, args *LookupVolumeOutputArgs, opts ...InvokeOption) LookupVolumeResultOutput> Note: This function is named LookupVolume in the Go SDK.
public static class GetVolume 
{
    public static Task<GetVolumeResult> InvokeAsync(GetVolumeArgs args, InvokeOptions? opts = null)
    public static Output<GetVolumeResult> Invoke(GetVolumeInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
public static Output<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ebs/getVolume:getVolume
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetVolume Filter> 
- 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.
- Dictionary<string, string>
- Map of tags for the resource.
- Filters
[]GetVolume Filter 
- 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.
- map[string]string
- Map of tags for the resource.
- filters
List<GetVolume Filter> 
- 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.
- Map<String,String>
- Map of tags for the resource.
- filters
GetVolume Filter[] 
- 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.
- {[key: string]: string}
- Map of tags for the resource.
- filters
Sequence[GetVolume Filter] 
- 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.
- Mapping[str, str]
- Map of tags for the resource.
- filters List<Property Map>
- 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.
- Map<String>
- Map of tags for the resource.
getVolume Result
The following output properties are available:
- Arn string
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- AvailabilityZone string
- 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
- Amount of IOPS for the disk.
- KmsKey stringId 
- ARN for the KMS encryption key.
- MultiAttach boolEnabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- OutpostArn string
- ARN of the Outpost.
- Size int
- Size of the drive in GiBs.
- SnapshotId string
- Snapshot_id the EBS volume is based off.
- Dictionary<string, string>
- Map of tags for the resource.
- Throughput int
- Throughput that the volume supports, in MiB/s.
- VolumeId string
- Volume ID (e.g., vol-59fcb34e).
- VolumeType string
- Type of EBS volume.
- Filters
List<GetVolume Filter> 
- MostRecent bool
- Arn string
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- AvailabilityZone string
- 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
- Amount of IOPS for the disk.
- KmsKey stringId 
- ARN for the KMS encryption key.
- MultiAttach boolEnabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- OutpostArn string
- ARN of the Outpost.
- Size int
- Size of the drive in GiBs.
- SnapshotId string
- Snapshot_id the EBS volume is based off.
- map[string]string
- Map of tags for the resource.
- Throughput int
- Throughput that the volume supports, in MiB/s.
- VolumeId string
- Volume ID (e.g., vol-59fcb34e).
- VolumeType string
- Type of EBS volume.
- Filters
[]GetVolume Filter 
- MostRecent bool
- arn String
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- availabilityZone String
- 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 Integer
- Amount of IOPS for the disk.
- kmsKey StringId 
- ARN for the KMS encryption key.
- multiAttach BooleanEnabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- outpostArn String
- ARN of the Outpost.
- size Integer
- Size of the drive in GiBs.
- snapshotId String
- Snapshot_id the EBS volume is based off.
- Map<String,String>
- Map of tags for the resource.
- throughput Integer
- Throughput that the volume supports, in MiB/s.
- volumeId String
- Volume ID (e.g., vol-59fcb34e).
- volumeType String
- Type of EBS volume.
- filters
List<GetVolume Filter> 
- mostRecent Boolean
- arn string
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- availabilityZone string
- 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
- Amount of IOPS for the disk.
- kmsKey stringId 
- ARN for the KMS encryption key.
- multiAttach booleanEnabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- outpostArn string
- ARN of the Outpost.
- size number
- Size of the drive in GiBs.
- snapshotId string
- Snapshot_id the EBS volume is based off.
- {[key: string]: string}
- Map of tags for the resource.
- throughput number
- Throughput that the volume supports, in MiB/s.
- volumeId string
- Volume ID (e.g., vol-59fcb34e).
- volumeType string
- Type of EBS volume.
- filters
GetVolume Filter[] 
- mostRecent boolean
- arn str
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- availability_zone str
- 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 int
- Amount of IOPS for the disk.
- kms_key_ strid 
- ARN for the KMS encryption key.
- multi_attach_ boolenabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- outpost_arn str
- ARN of the Outpost.
- size int
- Size of the drive in GiBs.
- snapshot_id str
- Snapshot_id the EBS volume is based off.
- Mapping[str, str]
- Map of tags for the resource.
- throughput int
- Throughput that the volume supports, in MiB/s.
- volume_id str
- Volume ID (e.g., vol-59fcb34e).
- volume_type str
- Type of EBS volume.
- filters
Sequence[GetVolume Filter] 
- most_recent bool
- arn String
- Volume ARN (e.g., arn:aws:ec2:us-east-1:123456789012:volume/vol-59fcb34e).
- availabilityZone String
- 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
- Amount of IOPS for the disk.
- kmsKey StringId 
- ARN for the KMS encryption key.
- multiAttach BooleanEnabled 
- (Optional) Specifies whether Amazon EBS Multi-Attach is enabled.
- outpostArn String
- ARN of the Outpost.
- size Number
- Size of the drive in GiBs.
- snapshotId String
- Snapshot_id the EBS volume is based off.
- Map<String>
- Map of tags for the resource.
- throughput Number
- Throughput that the volume supports, in MiB/s.
- volumeId String
- Volume ID (e.g., vol-59fcb34e).
- volumeType String
- Type of EBS volume.
- filters List<Property Map>
- mostRecent Boolean
Supporting Types
GetVolumeFilter  
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.