1. Packages
  2. AWS
  3. API Docs
  4. ssm
  5. getInstances
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ssm.getInstances

Explore with Pulumi AI

AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

Use this data source to get the instance IDs of SSM managed instances.

Example Usage

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

const example = aws.ssm.getInstances({
    filters: [{
        name: "PlatformTypes",
        values: ["Linux"],
    }],
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ssm.get_instances(filters=[{
    "name": "PlatformTypes",
    "values": ["Linux"],
}])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ssm.GetInstances(ctx, &ssm.GetInstancesArgs{
			Filters: []ssm.GetInstancesFilter{
				{
					Name: "PlatformTypes",
					Values: []string{
						"Linux",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Ssm.GetInstances.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ssm.Inputs.GetInstancesFilterInputArgs
            {
                Name = "PlatformTypes",
                Values = new[]
                {
                    "Linux",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssm.SsmFunctions;
import com.pulumi.aws.ssm.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 = SsmFunctions.getInstances(GetInstancesArgs.builder()
            .filters(GetInstancesFilterArgs.builder()
                .name("PlatformTypes")
                .values("Linux")
                .build())
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:ssm:getInstances
      arguments:
        filters:
          - name: PlatformTypes
            values:
              - Linux
Copy

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

> 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)
}
Copy
public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
public static Output<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ssm/getInstances:getInstances
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetInstancesFilter>
Configuration block(s) for filtering. Detailed below.
Filters []GetInstancesFilter
Configuration block(s) for filtering. Detailed below.
filters List<GetInstancesFilter>
Configuration block(s) for filtering. Detailed below.
filters GetInstancesFilter[]
Configuration block(s) for filtering. Detailed below.
filters Sequence[GetInstancesFilter]
Configuration block(s) for filtering. Detailed below.
filters List<Property Map>
Configuration block(s) for filtering. Detailed below.

getInstances Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Set of instance IDs of the matched SSM managed instances.
Filters List<GetInstancesFilter>
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Set of instance IDs of the matched SSM managed instances.
Filters []GetInstancesFilter
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
Set of instance IDs of the matched SSM managed instances.
filters List<GetInstancesFilter>
id string
The provider-assigned unique ID for this managed resource.
ids string[]
Set of instance IDs of the matched SSM managed instances.
filters GetInstancesFilter[]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
Set of instance IDs of the matched SSM managed instances.
filters Sequence[GetInstancesFilter]
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
Set of instance IDs of the matched SSM managed instances.
filters List<Property Map>

Supporting Types

GetInstancesFilter

Name This property is required. string
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
Values This property is required. List<string>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
Name This property is required. string
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
Values This property is required. []string
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
values This property is required. List<String>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. string
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
values This property is required. string[]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. str
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
values This property is required. Sequence[str]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the SSM InstanceInformationStringFilter API Reference.
values This property is required. 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 v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi