1. Packages
  2. AWS
  3. API Docs
  4. billing
  5. getViews
AWS v7.8.0 published on Tuesday, Oct 7, 2025 by Pulumi

aws.billing.getViews

Deploy with Pulumi
aws logo
AWS v7.8.0 published on Tuesday, Oct 7, 2025 by Pulumi

    Provides details about an AWS Billing Views.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.billing.getViews({
        billingViewTypes: ["PRIMARY"],
    });
    export const primaryViewArnByTypes = example.then(example => example.billingViews?.[0]?.arn);
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.billing.get_views(billing_view_types=["PRIMARY"])
    pulumi.export("primaryViewArnByTypes", example.billing_views[0].arn)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/billing"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := billing.GetViews(ctx, &billing.GetViewsArgs{
    			BillingViewTypes: []string{
    				"PRIMARY",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("primaryViewArnByTypes", example.BillingViews[0].Arn)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Billing.GetViews.Invoke(new()
        {
            BillingViewTypes = new[]
            {
                "PRIMARY",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["primaryViewArnByTypes"] = example.Apply(getViewsResult => getViewsResult.BillingViews[0]?.Arn),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.billing.BillingFunctions;
    import com.pulumi.aws.billing.inputs.GetViewsArgs;
    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 = BillingFunctions.getViews(GetViewsArgs.builder()
                .billingViewTypes("PRIMARY")
                .build());
    
            ctx.export("primaryViewArnByTypes", example.billingViews()[0].arn());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: aws:billing:getViews
          arguments:
            billingViewTypes:
              - PRIMARY
    outputs:
      primaryViewArnByTypes: ${example.billingViews[0].arn}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.billing.getViews({});
    export const viewArns = example.then(example => .map(view => (view.arn)));
    export const primaryViewArnByName = example.then(example => .filter(view => view.name == "Primary View").map(view => (view.arn))[0]);
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.billing.get_views()
    pulumi.export("viewArns", [view.arn for view in example.billing_views])
    pulumi.export("primaryViewArnByName", [view.arn for view in example.billing_views if view.name == "Primary View"][0])
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Billing.GetViews.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["viewArns"] = .Select(view => 
            {
                return view.Arn;
            }).ToList(),
            ["primaryViewArnByName"] = .Where(view => view.Name == "Primary View").Select(view => 
            {
                return view.Arn;
            }).ToList()[0],
        };
    });
    
    Example coming soon!
    
    Example coming soon!
    

    Using getViews

    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 getViews(args: GetViewsArgs, opts?: InvokeOptions): Promise<GetViewsResult>
    function getViewsOutput(args: GetViewsOutputArgs, opts?: InvokeOptions): Output<GetViewsResult>
    def get_views(billing_view_types: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetViewsResult
    def get_views_output(billing_view_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetViewsResult]
    func GetViews(ctx *Context, args *GetViewsArgs, opts ...InvokeOption) (*GetViewsResult, error)
    func GetViewsOutput(ctx *Context, args *GetViewsOutputArgs, opts ...InvokeOption) GetViewsResultOutput

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

    public static class GetViews 
    {
        public static Task<GetViewsResult> InvokeAsync(GetViewsArgs args, InvokeOptions? opts = null)
        public static Output<GetViewsResult> Invoke(GetViewsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetViewsResult> getViews(GetViewsArgs args, InvokeOptions options)
    public static Output<GetViewsResult> getViews(GetViewsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:billing/getViews:getViews
      arguments:
        # arguments dictionary

    The following arguments are supported:

    BillingViewTypes List<string>
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.
    BillingViewTypes []string
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.
    billingViewTypes List<String>
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.
    billingViewTypes string[]
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.
    billing_view_types Sequence[str]
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.
    billingViewTypes List<String>
    List of billing view types to retrieve. Valid values are PRIMARY, BILLING_GROUP, CUSTOM.

    getViews Result

    The following output properties are available:

    BillingViews List<GetViewsBillingView>
    List of billing view objects with the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    BillingViewTypes List<string>
    BillingViews []GetViewsBillingView
    List of billing view objects with the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    BillingViewTypes []string
    billingViews List<GetViewsBillingView>
    List of billing view objects with the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    billingViewTypes List<String>
    billingViews GetViewsBillingView[]
    List of billing view objects with the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    billingViewTypes string[]
    billing_views Sequence[GetViewsBillingView]
    List of billing view objects with the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    billing_view_types Sequence[str]
    billingViews List<Property Map>
    List of billing view objects with the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    billingViewTypes List<String>

    Supporting Types

    GetViewsBillingView

    Arn string
    ARN of the billing view.
    BillingViewType string
    Description string
    Description of the billing view.
    Name string
    Name of the billing view.
    OwnerAccountId string
    Account ID of the billing view owner.
    Arn string
    ARN of the billing view.
    BillingViewType string
    Description string
    Description of the billing view.
    Name string
    Name of the billing view.
    OwnerAccountId string
    Account ID of the billing view owner.
    arn String
    ARN of the billing view.
    billingViewType String
    description String
    Description of the billing view.
    name String
    Name of the billing view.
    ownerAccountId String
    Account ID of the billing view owner.
    arn string
    ARN of the billing view.
    billingViewType string
    description string
    Description of the billing view.
    name string
    Name of the billing view.
    ownerAccountId string
    Account ID of the billing view owner.
    arn str
    ARN of the billing view.
    billing_view_type str
    description str
    Description of the billing view.
    name str
    Name of the billing view.
    owner_account_id str
    Account ID of the billing view owner.
    arn String
    ARN of the billing view.
    billingViewType String
    description String
    Description of the billing view.
    name String
    Name of the billing view.
    ownerAccountId String
    Account ID of the billing view owner.

    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 v7.8.0 published on Tuesday, Oct 7, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate