1. Packages
  2. AWS
  3. API Docs
  4. ebs
  5. getEbsVolumes
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.ebs.getEbsVolumes

Explore with Pulumi AI

AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.ebs.getEbsVolumes provides identifying information for EBS volumes matching given criteria.

This data source can be useful for getting a list of volume IDs with (for example) matching tags.

Example Usage

The following demonstrates obtaining a map of availability zone to EBS volume ID for volumes with a given tag value.

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.ebs.getEbsVolumes({
    tags: {
        VolumeSet: "TestVolumeSet",
    },
});
const exampleGetVolume = example.then(example => .reduce((__obj, [__key, __value]) => ({ ...__obj, [__key]: aws.ebs.getVolume({
    filters: [{
        name: "volume-id",
        values: [__value],
    }],
}) })));
export const availabilityZoneToVolumeId = exampleGetVolume.apply(exampleGetVolume => Object.values(exampleGetVolume).reduce((__obj, s) => ({ ...__obj, [s.id]: s.availabilityZone })));
Copy
import pulumi
import pulumi_aws as aws

example = aws.ebs.get_ebs_volumes(tags={
    "VolumeSet": "TestVolumeSet",
})
example_get_volume = {__key: aws.ebs.get_volume(filters=[{
    "name": "volume-id",
    "values": [__value],
}]) for __key, __value in example.ids}
pulumi.export("availabilityZoneToVolumeId", {s.id: s.availability_zone for s in example_get_volume})
Copy
Coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Tags = 
        {
            { "VolumeSet", "TestVolumeSet" },
        },
    });

    var exampleGetVolume = ;

    return new Dictionary<string, object?>
    {
        ["availabilityZoneToVolumeId"] = exampleGetVolume.Apply(exampleGetVolume => (exampleGetVolume).Values.ToDictionary(item => {
            var s = item.Value;
            return s.Id;
        }, item => {
            var s = item.Value;
            return s.AvailabilityZone;
        })),
    };
});
Copy
Coming soon!
Coming soon!

Using getEbsVolumes

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 getEbsVolumes(args: GetEbsVolumesArgs, opts?: InvokeOptions): Promise<GetEbsVolumesResult>
function getEbsVolumesOutput(args: GetEbsVolumesOutputArgs, opts?: InvokeOptions): Output<GetEbsVolumesResult>
Copy
def get_ebs_volumes(filters: Optional[Sequence[GetEbsVolumesFilter]] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetEbsVolumesResult
def get_ebs_volumes_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetEbsVolumesFilterArgs]]]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetEbsVolumesResult]
Copy
func GetEbsVolumes(ctx *Context, args *GetEbsVolumesArgs, opts ...InvokeOption) (*GetEbsVolumesResult, error)
func GetEbsVolumesOutput(ctx *Context, args *GetEbsVolumesOutputArgs, opts ...InvokeOption) GetEbsVolumesResultOutput
Copy

> Note: This function is named GetEbsVolumes in the Go SDK.

public static class GetEbsVolumes 
{
    public static Task<GetEbsVolumesResult> InvokeAsync(GetEbsVolumesArgs args, InvokeOptions? opts = null)
    public static Output<GetEbsVolumesResult> Invoke(GetEbsVolumesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetEbsVolumesResult> getEbsVolumes(GetEbsVolumesArgs args, InvokeOptions options)
public static Output<GetEbsVolumesResult> getEbsVolumes(GetEbsVolumesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ebs/getEbsVolumes:getEbsVolumes
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetEbsVolumesFilter>
Custom filter block as described below.
Tags Dictionary<string, string>

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

Filters []GetEbsVolumesFilter
Custom filter block as described below.
Tags map[string]string

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

filters List<GetEbsVolumesFilter>
Custom filter block as described below.
tags Map<String,String>

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

filters GetEbsVolumesFilter[]
Custom filter block as described below.
tags {[key: string]: string}

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

filters Sequence[GetEbsVolumesFilter]
Custom filter block as described below.
tags Mapping[str, str]

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

filters List<Property Map>
Custom filter block as described below.
tags Map<String>

Map of tags, each pair of which must exactly match a pair on the desired volumes.

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

getEbsVolumes Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
Filters List<GetEbsVolumesFilter>
Tags Dictionary<string, string>
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
Filters []GetEbsVolumesFilter
Tags map[string]string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
filters List<GetEbsVolumesFilter>
tags Map<String,String>
id string
The provider-assigned unique ID for this managed resource.
ids string[]
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
filters GetEbsVolumesFilter[]
tags {[key: string]: string}
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
filters Sequence[GetEbsVolumesFilter]
tags Mapping[str, str]
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
Set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria.
filters List<Property Map>
tags Map<String>

Supporting Types

GetEbsVolumesFilter

Name This property is required. string
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_csharp">

Values This property is required. List<string>

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

Name This property is required. string
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_go">

Values This property is required. []string

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

name This property is required. String
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_java">

values This property is required. List<String>

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

name This property is required. string
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_nodejs">

values This property is required. string[]

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

name This property is required. str
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_python">

values This property is required. Sequence[str]

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

name This property is required. String
Name of the field to filter by, as defined by the underlying AWS API. For example, if matching against the size filter, use:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const tenOrTwentyGbVolumes = aws.ebs.getEbsVolumes({ filters: [{ name: "size", values: [ "10", "20", ], }], });

import pulumi
import pulumi_aws as aws

ten_or_twenty_gb_volumes = aws.ebs.get_ebs_volumes(filters=[{
    "name": "size",
    "values": [
        "10",
        "20",
    ],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var tenOrTwentyGbVolumes = Aws.Ebs.GetEbsVolumes.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetEbsVolumesFilterInputArgs
            {
                Name = "size",
                Values = new[]
                {
                    "10",
                    "20",
                },
            },
        },
    });

});
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.GetEbsVolumes(ctx, &ebs.GetEbsVolumesArgs{
			Filters: []ebs.GetEbsVolumesFilter{
				{
					Name: "size",
					Values: []string{
						"10",
						"20",
					},
				},
			},
		}, nil)
		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.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetEbsVolumesArgs;
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 tenOrTwentyGbVolumes = EbsFunctions.getEbsVolumes(GetEbsVolumesArgs.builder()
            .filters(GetEbsVolumesFilterArgs.builder()
                .name("size")
                .values(                
                    "10",
                    "20")
                .build())
            .build());

    }
}
variables:
  tenOrTwentyGbVolumes:
    fn::invoke:
      function: aws:ebs:getEbsVolumes
      arguments:
        filters:
          - name: size
            values:
              - '10'
              - '20'
title="Required"> <span id="values_yaml">

values This property is required. List<String>

Set of values that are accepted for the given field. EBS Volume IDs will be selected if any one of the given values match.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi