AWS v7.11.0 published on Wednesday, Nov 5, 2025 by Pulumi
aws.amp.getWorkspaces
Start a Neo task
Explain and create an aws.amp.getWorkspaces resource
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({});
import pulumi
import pulumi_aws as aws
example = aws.amp.get_workspaces()
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/amp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := amp.GetWorkspaces(ctx, &.GetWorkspacesArgs{}, 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.Amp.GetWorkspaces.Invoke();
});
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()
.build());
}
}
variables:
example:
fn::invoke:
function: aws:amp:getWorkspaces
arguments: {}
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",
});
import pulumi
import pulumi_aws as aws
example = aws.amp.get_workspaces(alias_prefix="example")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/amp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := amp.GetWorkspaces(ctx, &.GetWorkspacesArgs{
AliasPrefix: pulumi.StringRef("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 example = Aws.Amp.GetWorkspaces.Invoke(new()
{
AliasPrefix = "example",
});
});
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());
}
}
variables:
example:
fn::invoke:
function: aws:amp:getWorkspaces
arguments:
aliasPrefix: example
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>def get_workspaces(alias_prefix: Optional[str] = None,
region: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetWorkspacesResult
def get_workspaces_output(alias_prefix: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetWorkspacesResult]func GetWorkspaces(ctx *Context, args *GetWorkspacesArgs, opts ...InvokeOption) (*GetWorkspacesResult, error)
func GetWorkspacesOutput(ctx *Context, args *GetWorkspacesOutputArgs, opts ...InvokeOption) GetWorkspacesResultOutput> 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)
}public static CompletableFuture<GetWorkspacesResult> getWorkspaces(GetWorkspacesArgs args, InvokeOptions options)
public static Output<GetWorkspacesResult> getWorkspaces(GetWorkspacesArgs args, InvokeOptions options)
fn::invoke:
function: aws:amp/getWorkspaces:getWorkspaces
arguments:
# arguments dictionaryThe following arguments are supported:
- Alias
Prefix string - Limits results to workspaces with aliases that begin with this value.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Alias
Prefix string - Limits results to workspaces with aliases that begin with this value.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- alias
Prefix String - Limits results to workspaces with aliases that begin with this value.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- alias
Prefix string - Limits results to workspaces with aliases that begin with this value.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- alias_
prefix str - Limits results to workspaces with aliases that begin with this value.
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- alias
Prefix String - Limits results to workspaces with aliases that begin with this value.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
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.
- Region string
- Workspace
Ids List<string> - List of workspace IDs of the matched Prometheus workspaces.
- Alias
Prefix 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.
- Region string
- Workspace
Ids []string - List of workspace IDs of the matched Prometheus workspaces.
- Alias
Prefix 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.
- region String
- workspace
Ids List<String> - List of workspace IDs of the matched Prometheus workspaces.
- alias
Prefix 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.
- region string
- workspace
Ids string[] - List of workspace IDs of the matched Prometheus workspaces.
- alias
Prefix 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.
- region str
- 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.
- region String
- workspace
Ids List<String> - List of workspace IDs of the matched Prometheus workspaces.
- alias
Prefix String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
