aws.ebs.getEbsVolumes
Explore with Pulumi AI
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, [, ]) => ({ ...__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 })));
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})
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;
})),
};
});
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>
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]
func GetEbsVolumes(ctx *Context, args *GetEbsVolumesArgs, opts ...InvokeOption) (*GetEbsVolumesResult, error)
func GetEbsVolumesOutput(ctx *Context, args *GetEbsVolumesOutputArgs, opts ...InvokeOption) GetEbsVolumesResultOutput
> 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)
}
public static CompletableFuture<GetEbsVolumesResult> getEbsVolumes(GetEbsVolumesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ebs/getEbsVolumes:getEbsVolumes
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Ebs Volumes Filter> - Custom filter block as described below.
- 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
[]Get
Ebs Volumes Filter - Custom filter block as described below.
- 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<Get
Ebs Volumes Filter> - Custom filter block as described below.
- 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
Get
Ebs Volumes Filter[] - Custom filter block as described below.
- {[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[Get
Ebs Volumes Filter] - Custom filter block as described below.
- 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.
- 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<Get
Ebs Volumes Filter> - 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
[]Get
Ebs Volumes Filter - 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<Get
Ebs Volumes Filter> - 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
Get
Ebs Volumes Filter[] - {[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[Get
Ebs Volumes Filter] - 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>
- Map<String>
Supporting Types
GetEbsVolumesFilter
- Name 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 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 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 []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 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 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 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 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 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 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 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 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.