1. Packages
  2. AWS
  3. API Docs
  4. rds
  5. getInstances
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.rds.getInstances

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    Data source for listing RDS Database Instances.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.rds.getInstances({
        filters: [{
            name: "db-instance-id",
            values: ["my-database-id"],
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.rds.get_instances(filters=[{
        "name": "db-instance-id",
        "values": ["my-database-id"],
    }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := rds.GetInstances(ctx, &rds.GetInstancesArgs{
    			Filters: []rds.GetInstancesFilter{
    				{
    					Name: "db-instance-id",
    					Values: []string{
    						"my-database-id",
    					},
    				},
    			},
    		}, 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 example = Aws.Rds.GetInstances.Invoke(new()
        {
            Filters = new[]
            {
                new Aws.Rds.Inputs.GetInstancesFilterInputArgs
                {
                    Name = "db-instance-id",
                    Values = new[]
                    {
                        "my-database-id",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.rds.RdsFunctions;
    import com.pulumi.aws.rds.inputs.GetInstancesArgs;
    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 example = RdsFunctions.getInstances(GetInstancesArgs.builder()
                .filters(GetInstancesFilterArgs.builder()
                    .name("db-instance-id")
                    .values("my-database-id")
                    .build())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:rds:getInstances
          Arguments:
            filters:
              - name: db-instance-id
                values:
                  - my-database-id
    

    Using tags

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.rds.getInstances({
        tags: {
            Env: "test",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.rds.get_instances(tags={
        "Env": "test",
    })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := rds.GetInstances(ctx, &rds.GetInstancesArgs{
    			Tags: map[string]interface{}{
    				"Env": "test",
    			},
    		}, 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 example = Aws.Rds.GetInstances.Invoke(new()
        {
            Tags = 
            {
                { "Env", "test" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.rds.RdsFunctions;
    import com.pulumi.aws.rds.inputs.GetInstancesArgs;
    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 example = RdsFunctions.getInstances(GetInstancesArgs.builder()
                .tags(Map.of("Env", "test"))
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:rds:getInstances
          Arguments:
            tags:
              Env: test
    

    Using getInstances

    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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
    function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>
    def get_instances(filters: Optional[Sequence[GetInstancesFilter]] = None,
                      tags: Optional[Mapping[str, str]] = None,
                      opts: Optional[InvokeOptions] = None) -> GetInstancesResult
    def get_instances_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetInstancesFilterArgs]]]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetInstancesResult]
    func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
    func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput

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

    public static class GetInstances 
    {
        public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:rds/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetInstancesFilter>
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    Tags Dictionary<string, string>
    Map of tags, each pair of which must exactly match a pair on the desired instances.
    Filters []GetInstancesFilter
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    Tags map[string]string
    Map of tags, each pair of which must exactly match a pair on the desired instances.
    filters List<GetInstancesFilter>
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    tags Map<String,String>
    Map of tags, each pair of which must exactly match a pair on the desired instances.
    filters GetInstancesFilter[]
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    tags {[key: string]: string}
    Map of tags, each pair of which must exactly match a pair on the desired instances.
    filters Sequence[GetInstancesFilter]
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    tags Mapping[str, str]
    Map of tags, each pair of which must exactly match a pair on the desired instances.
    filters List<Property Map>
    Configuration block(s) used to filter instances with AWS supported attributes, such as engine, db-cluster-id or db-instance-id for example. Detailed below.
    tags Map<String>
    Map of tags, each pair of which must exactly match a pair on the desired instances.

    getInstances Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceArns List<string>
    ARNs of the matched RDS instances.
    InstanceIdentifiers List<string>
    Identifiers of the matched RDS instances.
    Tags Dictionary<string, string>
    Filters List<GetInstancesFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceArns []string
    ARNs of the matched RDS instances.
    InstanceIdentifiers []string
    Identifiers of the matched RDS instances.
    Tags map[string]string
    Filters []GetInstancesFilter
    id String
    The provider-assigned unique ID for this managed resource.
    instanceArns List<String>
    ARNs of the matched RDS instances.
    instanceIdentifiers List<String>
    Identifiers of the matched RDS instances.
    tags Map<String,String>
    filters List<GetInstancesFilter>
    id string
    The provider-assigned unique ID for this managed resource.
    instanceArns string[]
    ARNs of the matched RDS instances.
    instanceIdentifiers string[]
    Identifiers of the matched RDS instances.
    tags {[key: string]: string}
    filters GetInstancesFilter[]
    id str
    The provider-assigned unique ID for this managed resource.
    instance_arns Sequence[str]
    ARNs of the matched RDS instances.
    instance_identifiers Sequence[str]
    Identifiers of the matched RDS instances.
    tags Mapping[str, str]
    filters Sequence[GetInstancesFilter]
    id String
    The provider-assigned unique ID for this managed resource.
    instanceArns List<String>
    ARNs of the matched RDS instances.
    instanceIdentifiers List<String>
    Identifiers of the matched RDS instances.
    tags Map<String>
    filters List<Property Map>

    Supporting Types

    GetInstancesFilter

    Name string
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    Values List<string>
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
    Name string
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    Values []string
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
    name String
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    values List<String>
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
    name string
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    values string[]
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
    name str
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    values Sequence[str]
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
    name String
    Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.
    values List<String>
    Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

    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.54.0 published on Friday, Sep 27, 2024 by Pulumi