1. Packages
  2. AWS
  3. API Docs
  4. ebs
  5. getSnapshotIds
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ebs.getSnapshotIds

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Use this data source to get a list of EBS Snapshot IDs matching the specified criteria.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const ebsVolumes = aws.ebs.getSnapshotIds({
        owners: ["self"],
        filters: [
            {
                name: "volume-size",
                values: ["40"],
            },
            {
                name: "tag:Name",
                values: ["Example"],
            },
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    ebs_volumes = aws.ebs.get_snapshot_ids(owners=["self"],
        filters=[
            {
                "name": "volume-size",
                "values": ["40"],
            },
            {
                "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.GetSnapshotIds(ctx, &ebs.GetSnapshotIdsArgs{
    			Owners: []string{
    				"self",
    			},
    			Filters: []ebs.GetSnapshotIdsFilter{
    				{
    					Name: "volume-size",
    					Values: []string{
    						"40",
    					},
    				},
    				{
    					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 ebsVolumes = Aws.Ebs.GetSnapshotIds.Invoke(new()
        {
            Owners = new[]
            {
                "self",
            },
            Filters = new[]
            {
                new Aws.Ebs.Inputs.GetSnapshotIdsFilterInputArgs
                {
                    Name = "volume-size",
                    Values = new[]
                    {
                        "40",
                    },
                },
                new Aws.Ebs.Inputs.GetSnapshotIdsFilterInputArgs
                {
                    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.GetSnapshotIdsArgs;
    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 ebsVolumes = EbsFunctions.getSnapshotIds(GetSnapshotIdsArgs.builder()
                .owners("self")
                .filters(            
                    GetSnapshotIdsFilterArgs.builder()
                        .name("volume-size")
                        .values("40")
                        .build(),
                    GetSnapshotIdsFilterArgs.builder()
                        .name("tag:Name")
                        .values("Example")
                        .build())
                .build());
    
        }
    }
    
    variables:
      ebsVolumes:
        fn::invoke:
          Function: aws:ebs:getSnapshotIds
          Arguments:
            owners:
              - self
            filters:
              - name: volume-size
                values:
                  - '40'
              - name: tag:Name
                values:
                  - Example
    

    Using getSnapshotIds

    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 getSnapshotIds(args: GetSnapshotIdsArgs, opts?: InvokeOptions): Promise<GetSnapshotIdsResult>
    function getSnapshotIdsOutput(args: GetSnapshotIdsOutputArgs, opts?: InvokeOptions): Output<GetSnapshotIdsResult>
    def get_snapshot_ids(filters: Optional[Sequence[GetSnapshotIdsFilter]] = None,
                         owners: Optional[Sequence[str]] = None,
                         restorable_by_user_ids: Optional[Sequence[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetSnapshotIdsResult
    def get_snapshot_ids_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSnapshotIdsFilterArgs]]]] = None,
                         owners: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         restorable_by_user_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetSnapshotIdsResult]
    func GetSnapshotIds(ctx *Context, args *GetSnapshotIdsArgs, opts ...InvokeOption) (*GetSnapshotIdsResult, error)
    func GetSnapshotIdsOutput(ctx *Context, args *GetSnapshotIdsOutputArgs, opts ...InvokeOption) GetSnapshotIdsResultOutput

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

    public static class GetSnapshotIds 
    {
        public static Task<GetSnapshotIdsResult> InvokeAsync(GetSnapshotIdsArgs args, InvokeOptions? opts = null)
        public static Output<GetSnapshotIdsResult> Invoke(GetSnapshotIdsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSnapshotIdsResult> getSnapshotIds(GetSnapshotIdsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ebs/getSnapshotIds:getSnapshotIds
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetSnapshotIdsFilter>
    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].
    Owners List<string>
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    RestorableByUserIds List<string>
    One or more AWS accounts IDs that can create volumes from the snapshot.
    Filters []GetSnapshotIdsFilter
    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].
    Owners []string
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    RestorableByUserIds []string
    One or more AWS accounts IDs that can create volumes from the snapshot.
    filters List<GetSnapshotIdsFilter>
    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].
    owners List<String>
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    restorableByUserIds List<String>
    One or more AWS accounts IDs that can create volumes from the snapshot.
    filters GetSnapshotIdsFilter[]
    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].
    owners string[]
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    restorableByUserIds string[]
    One or more AWS accounts IDs that can create volumes from the snapshot.
    filters Sequence[GetSnapshotIdsFilter]
    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].
    owners Sequence[str]
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    restorable_by_user_ids Sequence[str]
    One or more AWS accounts IDs that can create volumes from the snapshot.
    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].
    owners List<String>
    Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
    restorableByUserIds List<String>
    One or more AWS accounts IDs that can create volumes from the snapshot.

    getSnapshotIds Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    Filters List<GetSnapshotIdsFilter>
    Owners List<string>
    RestorableByUserIds List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    Filters []GetSnapshotIdsFilter
    Owners []string
    RestorableByUserIds []string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    filters List<GetSnapshotIdsFilter>
    owners List<String>
    restorableByUserIds List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    filters GetSnapshotIdsFilter[]
    owners string[]
    restorableByUserIds string[]
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    filters Sequence[GetSnapshotIdsFilter]
    owners Sequence[str]
    restorable_by_user_ids Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    Set of EBS snapshot IDs, sorted by creation time in descending order.
    filters List<Property Map>
    owners List<String>
    restorableByUserIds List<String>

    Supporting Types

    GetSnapshotIdsFilter

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

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi