1. Packages
  2. AWS
  3. API Docs
  4. amp
  5. getWorkspaces
AWS v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi

aws.amp.getWorkspaces

Explore with Pulumi AI

AWS v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi

Provides the aliases, ARNs, and workspace IDs of Amazon Prometheus workspaces.

Example Usage

The following example returns all of the workspaces in a region:

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

const example = aws.amp.getWorkspaces({});
Copy
import pulumi
import pulumi_aws as aws

example = aws.amp.get_workspaces()
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := amp.GetWorkspaces(ctx, &amp.GetWorkspacesArgs{}, 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.Amp.GetWorkspaces.Invoke();

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amp.AmpFunctions;
import com.pulumi.aws.amp.inputs.GetWorkspacesArgs;
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 = AmpFunctions.getWorkspaces();

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:amp:getWorkspaces
      arguments: {}
Copy

The following example filters the workspaces by alias. Only the workspaces with aliases that begin with the value of alias_prefix will be returned:

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

const example = aws.amp.getWorkspaces({
    aliasPrefix: "example",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.amp.get_workspaces(alias_prefix="example")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := amp.GetWorkspaces(ctx, &amp.GetWorkspacesArgs{
			AliasPrefix: pulumi.StringRef("example"),
		}, 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.Amp.GetWorkspaces.Invoke(new()
    {
        AliasPrefix = "example",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amp.AmpFunctions;
import com.pulumi.aws.amp.inputs.GetWorkspacesArgs;
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 = AmpFunctions.getWorkspaces(GetWorkspacesArgs.builder()
            .aliasPrefix("example")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:amp:getWorkspaces
      arguments:
        aliasPrefix: example
Copy

Using getWorkspaces

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 getWorkspaces(args: GetWorkspacesArgs, opts?: InvokeOptions): Promise<GetWorkspacesResult>
function getWorkspacesOutput(args: GetWorkspacesOutputArgs, opts?: InvokeOptions): Output<GetWorkspacesResult>
Copy
def get_workspaces(alias_prefix: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetWorkspacesResult
def get_workspaces_output(alias_prefix: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetWorkspacesResult]
Copy
func GetWorkspaces(ctx *Context, args *GetWorkspacesArgs, opts ...InvokeOption) (*GetWorkspacesResult, error)
func GetWorkspacesOutput(ctx *Context, args *GetWorkspacesOutputArgs, opts ...InvokeOption) GetWorkspacesResultOutput
Copy

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

public static class GetWorkspaces 
{
    public static Task<GetWorkspacesResult> InvokeAsync(GetWorkspacesArgs args, InvokeOptions? opts = null)
    public static Output<GetWorkspacesResult> Invoke(GetWorkspacesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetWorkspacesResult> getWorkspaces(GetWorkspacesArgs args, InvokeOptions options)
public static Output<GetWorkspacesResult> getWorkspaces(GetWorkspacesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:amp/getWorkspaces:getWorkspaces
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

AliasPrefix string
Limits results to workspaces with aliases that begin with this value.
AliasPrefix string
Limits results to workspaces with aliases that begin with this value.
aliasPrefix String
Limits results to workspaces with aliases that begin with this value.
aliasPrefix string
Limits results to workspaces with aliases that begin with this value.
alias_prefix str
Limits results to workspaces with aliases that begin with this value.
aliasPrefix String
Limits results to workspaces with aliases that begin with this value.

getWorkspaces Result

The following output properties are available:

Aliases List<string>
List of aliases of the matched Prometheus workspaces.
Arns List<string>
List of ARNs of the matched Prometheus workspaces.
Id string
The provider-assigned unique ID for this managed resource.
WorkspaceIds List<string>
List of workspace IDs of the matched Prometheus workspaces.
AliasPrefix string
Aliases []string
List of aliases of the matched Prometheus workspaces.
Arns []string
List of ARNs of the matched Prometheus workspaces.
Id string
The provider-assigned unique ID for this managed resource.
WorkspaceIds []string
List of workspace IDs of the matched Prometheus workspaces.
AliasPrefix string
aliases List<String>
List of aliases of the matched Prometheus workspaces.
arns List<String>
List of ARNs of the matched Prometheus workspaces.
id String
The provider-assigned unique ID for this managed resource.
workspaceIds List<String>
List of workspace IDs of the matched Prometheus workspaces.
aliasPrefix String
aliases string[]
List of aliases of the matched Prometheus workspaces.
arns string[]
List of ARNs of the matched Prometheus workspaces.
id string
The provider-assigned unique ID for this managed resource.
workspaceIds string[]
List of workspace IDs of the matched Prometheus workspaces.
aliasPrefix string
aliases Sequence[str]
List of aliases of the matched Prometheus workspaces.
arns Sequence[str]
List of ARNs of the matched Prometheus workspaces.
id str
The provider-assigned unique ID for this managed resource.
workspace_ids Sequence[str]
List of workspace IDs of the matched Prometheus workspaces.
alias_prefix str
aliases List<String>
List of aliases of the matched Prometheus workspaces.
arns List<String>
List of ARNs of the matched Prometheus workspaces.
id String
The provider-assigned unique ID for this managed resource.
workspaceIds List<String>
List of workspace IDs of the matched Prometheus workspaces.
aliasPrefix 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 v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi