1. Packages
  2. AWS
  3. API Docs
  4. s3
  5. FilesFileSystemPolicy
Viewing docs for AWS v7.26.0
published on Thursday, Apr 16, 2026 by Pulumi
aws logo
Viewing docs for AWS v7.26.0
published on Thursday, Apr 16, 2026 by Pulumi

    Manages an S3 Files File System Policy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.getCallerIdentity({});
    const currentGetPartition = aws.getPartition({});
    const example = new aws.s3.FilesFileSystemPolicy("example", {
        fileSystemId: exampleAwsS3filesFileSystem.id,
        policy: JSON.stringify({
            Version: "2012-10-17",
            Statement: [{
                Effect: "Allow",
                Principal: {
                    AWS: Promise.all([currentGetPartition, current]).then(([currentGetPartition, current]) => `arn:${currentGetPartition.partition}:iam::${current.accountId}:root`),
                },
                Action: "s3files:ClientMount",
                Resource: "*",
            }],
        }),
    });
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    current = aws.get_caller_identity()
    current_get_partition = aws.get_partition()
    example = aws.s3.FilesFileSystemPolicy("example",
        file_system_id=example_aws_s3files_file_system["id"],
        policy=json.dumps({
            "Version": "2012-10-17",
            "Statement": [{
                "Effect": "Allow",
                "Principal": {
                    "AWS": f"arn:{current_get_partition.partition}:iam::{current.account_id}:root",
                },
                "Action": "s3files:ClientMount",
                "Resource": "*",
            }],
        }))
    
    package main
    
    import (
    	"encoding/json"
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		currentGetPartition, err := aws.GetPartition(ctx, &aws.GetPartitionArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"Version": "2012-10-17",
    			"Statement": []map[string]interface{}{
    				map[string]interface{}{
    					"Effect": "Allow",
    					"Principal": map[string]interface{}{
    						"AWS": fmt.Sprintf("arn:%v:iam::%v:root", currentGetPartition.Partition, current.AccountId),
    					},
    					"Action":   "s3files:ClientMount",
    					"Resource": "*",
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = s3.NewFilesFileSystemPolicy(ctx, "example", &s3.FilesFileSystemPolicyArgs{
    			FileSystemId: pulumi.Any(exampleAwsS3filesFileSystem.Id),
    			Policy:       json0,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Aws.Index.GetCallerIdentity.Invoke();
    
        var currentGetPartition = Aws.Index.GetPartition.Invoke();
    
        var example = new Aws.S3.FilesFileSystemPolicy("example", new()
        {
            FileSystemId = exampleAwsS3filesFileSystem.Id,
            Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["Version"] = "2012-10-17",
                ["Statement"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["Effect"] = "Allow",
                        ["Principal"] = new Dictionary<string, object?>
                        {
                            ["AWS"] = Output.Tuple(currentGetPartition, current).Apply(values =>
                            {
                                var currentGetPartition = values.Item1;
                                var current = values.Item2;
                                return $"arn:{currentGetPartition.Apply(getPartitionResult => getPartitionResult.Partition)}:iam::{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:root";
                            }),
                        },
                        ["Action"] = "s3files:ClientMount",
                        ["Resource"] = "*",
                    },
                },
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.AwsFunctions;
    import com.pulumi.aws.inputs.GetCallerIdentityArgs;
    import com.pulumi.aws.inputs.GetPartitionArgs;
    import com.pulumi.aws.s3.FilesFileSystemPolicy;
    import com.pulumi.aws.s3.FilesFileSystemPolicyArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
                .build());
    
            final var currentGetPartition = AwsFunctions.getPartition(GetPartitionArgs.builder()
                .build());
    
            var example = new FilesFileSystemPolicy("example", FilesFileSystemPolicyArgs.builder()
                .fileSystemId(exampleAwsS3filesFileSystem.id())
                .policy(serializeJson(
                    jsonObject(
                        jsonProperty("Version", "2012-10-17"),
                        jsonProperty("Statement", jsonArray(jsonObject(
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", jsonObject(
                                jsonProperty("AWS", String.format("arn:%s:iam::%s:root", currentGetPartition.partition(),current.accountId()))
                            )),
                            jsonProperty("Action", "s3files:ClientMount"),
                            jsonProperty("Resource", "*")
                        )))
                    )))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:FilesFileSystemPolicy
        properties:
          fileSystemId: ${exampleAwsS3filesFileSystem.id}
          policy:
            fn::toJSON:
              Version: 2012-10-17
              Statement:
                - Effect: Allow
                  Principal:
                    AWS: arn:${currentGetPartition.partition}:iam::${current.accountId}:root
                  Action: s3files:ClientMount
                  Resource: '*'
    variables:
      current:
        fn::invoke:
          function: aws:getCallerIdentity
          arguments: {}
      currentGetPartition:
        fn::invoke:
          function: aws:getPartition
          arguments: {}
    

    Create FilesFileSystemPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new FilesFileSystemPolicy(name: string, args: FilesFileSystemPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def FilesFileSystemPolicy(resource_name: str,
                              args: FilesFileSystemPolicyArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def FilesFileSystemPolicy(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              file_system_id: Optional[str] = None,
                              policy: Optional[str] = None,
                              region: Optional[str] = None)
    func NewFilesFileSystemPolicy(ctx *Context, name string, args FilesFileSystemPolicyArgs, opts ...ResourceOption) (*FilesFileSystemPolicy, error)
    public FilesFileSystemPolicy(string name, FilesFileSystemPolicyArgs args, CustomResourceOptions? opts = null)
    public FilesFileSystemPolicy(String name, FilesFileSystemPolicyArgs args)
    public FilesFileSystemPolicy(String name, FilesFileSystemPolicyArgs args, CustomResourceOptions options)
    
    type: aws:s3:FilesFileSystemPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args FilesFileSystemPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FilesFileSystemPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FilesFileSystemPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FilesFileSystemPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FilesFileSystemPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var filesFileSystemPolicyResource = new Aws.S3.FilesFileSystemPolicy("filesFileSystemPolicyResource", new()
    {
        FileSystemId = "string",
        Policy = "string",
        Region = "string",
    });
    
    example, err := s3.NewFilesFileSystemPolicy(ctx, "filesFileSystemPolicyResource", &s3.FilesFileSystemPolicyArgs{
    	FileSystemId: pulumi.String("string"),
    	Policy:       pulumi.String("string"),
    	Region:       pulumi.String("string"),
    })
    
    var filesFileSystemPolicyResource = new FilesFileSystemPolicy("filesFileSystemPolicyResource", FilesFileSystemPolicyArgs.builder()
        .fileSystemId("string")
        .policy("string")
        .region("string")
        .build());
    
    files_file_system_policy_resource = aws.s3.FilesFileSystemPolicy("filesFileSystemPolicyResource",
        file_system_id="string",
        policy="string",
        region="string")
    
    const filesFileSystemPolicyResource = new aws.s3.FilesFileSystemPolicy("filesFileSystemPolicyResource", {
        fileSystemId: "string",
        policy: "string",
        region: "string",
    });
    
    type: aws:s3:FilesFileSystemPolicy
    properties:
        fileSystemId: string
        policy: string
        region: string
    

    FilesFileSystemPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The FilesFileSystemPolicy resource accepts the following input properties:

    FileSystemId string
    File system ID. Changing this value forces replacement.
    Policy string

    JSON policy document.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    FileSystemId string
    File system ID. Changing this value forces replacement.
    Policy string

    JSON policy document.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId String
    File system ID. Changing this value forces replacement.
    policy String

    JSON policy document.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId string
    File system ID. Changing this value forces replacement.
    policy string

    JSON policy document.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    file_system_id str
    File system ID. Changing this value forces replacement.
    policy str

    JSON policy document.

    The following arguments are optional:

    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId String
    File system ID. Changing this value forces replacement.
    policy String

    JSON policy document.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FilesFileSystemPolicy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing FilesFileSystemPolicy Resource

    Get an existing FilesFileSystemPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: FilesFileSystemPolicyState, opts?: CustomResourceOptions): FilesFileSystemPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            file_system_id: Optional[str] = None,
            policy: Optional[str] = None,
            region: Optional[str] = None) -> FilesFileSystemPolicy
    func GetFilesFileSystemPolicy(ctx *Context, name string, id IDInput, state *FilesFileSystemPolicyState, opts ...ResourceOption) (*FilesFileSystemPolicy, error)
    public static FilesFileSystemPolicy Get(string name, Input<string> id, FilesFileSystemPolicyState? state, CustomResourceOptions? opts = null)
    public static FilesFileSystemPolicy get(String name, Output<String> id, FilesFileSystemPolicyState state, CustomResourceOptions options)
    resources:  _:    type: aws:s3:FilesFileSystemPolicy    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    FileSystemId string
    File system ID. Changing this value forces replacement.
    Policy string

    JSON policy document.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    FileSystemId string
    File system ID. Changing this value forces replacement.
    Policy string

    JSON policy document.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId String
    File system ID. Changing this value forces replacement.
    policy String

    JSON policy document.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId string
    File system ID. Changing this value forces replacement.
    policy string

    JSON policy document.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    file_system_id str
    File system ID. Changing this value forces replacement.
    policy str

    JSON policy document.

    The following arguments are optional:

    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    fileSystemId String
    File system ID. Changing this value forces replacement.
    policy String

    JSON policy document.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.

    Import

    Identity Schema

    Required

    • fileSystemId - File system ID.

    Optional

    • accountId (String) AWS Account where this resource is managed.
    • region (String) Region where this resource is managed.

    Using pulumi import, import S3 Files File System Policy using fileSystemId. For example:

    $ pulumi import aws:s3/filesFileSystemPolicy:FilesFileSystemPolicy example fs-1234567890abcdef0
    

    To learn more about importing existing cloud resources, see Importing resources.

    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
    Viewing docs for AWS v7.26.0
    published on Thursday, Apr 16, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.