1. Packages
  2. AWS Classic
  3. API Docs
  4. s3
  5. getCanonicalUserId

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

aws.s3.getCanonicalUserId

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi

    The Canonical User ID data source allows access to the canonical user ID for the effective account in which this provider is working.

    NOTE: To use this data source, you must have the s3:ListAllMyBuckets permission.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.s3.getCanonicalUserId({});
    export const canonicalUserId = current.then(current => current.id);
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.s3.get_canonical_user_id()
    pulumi.export("canonicalUserId", current.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := s3.GetCanonicalUserId(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("canonicalUserId", current.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Aws.S3.GetCanonicalUserId.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["canonicalUserId"] = current.Apply(getCanonicalUserIdResult => getCanonicalUserIdResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.S3Functions;
    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 current = S3Functions.getCanonicalUserId();
    
            ctx.export("canonicalUserId", current.applyValue(getCanonicalUserIdResult -> getCanonicalUserIdResult.id()));
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: aws:s3:getCanonicalUserId
          Arguments: {}
    outputs:
      canonicalUserId: ${current.id}
    

    Using getCanonicalUserId

    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 getCanonicalUserId(opts?: InvokeOptions): Promise<GetCanonicalUserIdResult>
    function getCanonicalUserIdOutput(opts?: InvokeOptions): Output<GetCanonicalUserIdResult>
    def get_canonical_user_id(opts: Optional[InvokeOptions] = None) -> GetCanonicalUserIdResult
    def get_canonical_user_id_output(opts: Optional[InvokeOptions] = None) -> Output[GetCanonicalUserIdResult]
    func GetCanonicalUserId(ctx *Context, opts ...InvokeOption) (*GetCanonicalUserIdResult, error)
    func GetCanonicalUserIdOutput(ctx *Context, opts ...InvokeOption) GetCanonicalUserIdResultOutput

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

    public static class GetCanonicalUserId 
    {
        public static Task<GetCanonicalUserIdResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetCanonicalUserIdResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCanonicalUserIdResult> getCanonicalUserId(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:s3/getCanonicalUserId:getCanonicalUserId
      arguments:
        # arguments dictionary

    getCanonicalUserId Result

    The following output properties are available:

    DisplayName string
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    Id string
    The provider-assigned unique ID for this managed resource.
    DisplayName string
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    Id string
    The provider-assigned unique ID for this managed resource.
    displayName String
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    id String
    The provider-assigned unique ID for this managed resource.
    displayName string
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    id string
    The provider-assigned unique ID for this managed resource.
    display_name str
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    id str
    The provider-assigned unique ID for this managed resource.
    displayName String
    Human-friendly name linked to the canonical user ID. The bucket owner's display name. NOTE: This value is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    id String
    The provider-assigned unique ID for this managed resource.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.40.0 published on Wednesday, Jun 12, 2024 by Pulumi