1. Packages
  2. AWS
  3. API Docs
  4. efs
  5. BackupPolicy
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.efs.BackupPolicy

Explore with Pulumi AI

Provides an Elastic File System (EFS) Backup Policy resource. Backup policies turn automatic backups on or off for an existing file system.

Example Usage

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

const fs = new aws.efs.FileSystem("fs", {creationToken: "my-product"});
const policy = new aws.efs.BackupPolicy("policy", {
    fileSystemId: fs.id,
    backupPolicy: {
        status: "ENABLED",
    },
});
Copy
import pulumi
import pulumi_aws as aws

fs = aws.efs.FileSystem("fs", creation_token="my-product")
policy = aws.efs.BackupPolicy("policy",
    file_system_id=fs.id,
    backup_policy={
        "status": "ENABLED",
    })
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fs, err := efs.NewFileSystem(ctx, "fs", &efs.FileSystemArgs{
			CreationToken: pulumi.String("my-product"),
		})
		if err != nil {
			return err
		}
		_, err = efs.NewBackupPolicy(ctx, "policy", &efs.BackupPolicyArgs{
			FileSystemId: fs.ID(),
			BackupPolicy: &efs.BackupPolicyBackupPolicyArgs{
				Status: pulumi.String("ENABLED"),
			},
		})
		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 fs = new Aws.Efs.FileSystem("fs", new()
    {
        CreationToken = "my-product",
    });

    var policy = new Aws.Efs.BackupPolicy("policy", new()
    {
        FileSystemId = fs.Id,
        BackupPolicyDetails = new Aws.Efs.Inputs.BackupPolicyBackupPolicyArgs
        {
            Status = "ENABLED",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.efs.FileSystem;
import com.pulumi.aws.efs.FileSystemArgs;
import com.pulumi.aws.efs.BackupPolicy;
import com.pulumi.aws.efs.BackupPolicyArgs;
import com.pulumi.aws.efs.inputs.BackupPolicyBackupPolicyArgs;
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) {
        var fs = new FileSystem("fs", FileSystemArgs.builder()
            .creationToken("my-product")
            .build());

        var policy = new BackupPolicy("policy", BackupPolicyArgs.builder()
            .fileSystemId(fs.id())
            .backupPolicy(BackupPolicyBackupPolicyArgs.builder()
                .status("ENABLED")
                .build())
            .build());

    }
}
Copy
resources:
  fs:
    type: aws:efs:FileSystem
    properties:
      creationToken: my-product
  policy:
    type: aws:efs:BackupPolicy
    properties:
      fileSystemId: ${fs.id}
      backupPolicy:
        status: ENABLED
Copy

Create BackupPolicy Resource

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

Constructor syntax

new BackupPolicy(name: string, args: BackupPolicyArgs, opts?: CustomResourceOptions);
@overload
def BackupPolicy(resource_name: str,
                 args: BackupPolicyArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def BackupPolicy(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 backup_policy: Optional[BackupPolicyBackupPolicyArgs] = None,
                 file_system_id: Optional[str] = None)
func NewBackupPolicy(ctx *Context, name string, args BackupPolicyArgs, opts ...ResourceOption) (*BackupPolicy, error)
public BackupPolicy(string name, BackupPolicyArgs args, CustomResourceOptions? opts = null)
public BackupPolicy(String name, BackupPolicyArgs args)
public BackupPolicy(String name, BackupPolicyArgs args, CustomResourceOptions options)
type: aws:efs:BackupPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. BackupPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. BackupPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. BackupPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. BackupPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. BackupPolicyArgs
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 backupPolicyResource = new Aws.Efs.BackupPolicy("backupPolicyResource", new()
{
    BackupPolicyDetails = new Aws.Efs.Inputs.BackupPolicyBackupPolicyArgs
    {
        Status = "string",
    },
    FileSystemId = "string",
});
Copy
example, err := efs.NewBackupPolicy(ctx, "backupPolicyResource", &efs.BackupPolicyArgs{
	BackupPolicy: &efs.BackupPolicyBackupPolicyArgs{
		Status: pulumi.String("string"),
	},
	FileSystemId: pulumi.String("string"),
})
Copy
var backupPolicyResource = new BackupPolicy("backupPolicyResource", BackupPolicyArgs.builder()
    .backupPolicy(BackupPolicyBackupPolicyArgs.builder()
        .status("string")
        .build())
    .fileSystemId("string")
    .build());
Copy
backup_policy_resource = aws.efs.BackupPolicy("backupPolicyResource",
    backup_policy={
        "status": "string",
    },
    file_system_id="string")
Copy
const backupPolicyResource = new aws.efs.BackupPolicy("backupPolicyResource", {
    backupPolicy: {
        status: "string",
    },
    fileSystemId: "string",
});
Copy
type: aws:efs:BackupPolicy
properties:
    backupPolicy:
        status: string
    fileSystemId: string
Copy

BackupPolicy 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 BackupPolicy resource accepts the following input properties:

BackupPolicyDetails This property is required. BackupPolicyBackupPolicy
A backup_policy object (documented below).
FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the EFS file system.
BackupPolicy This property is required. BackupPolicyBackupPolicyArgs
A backup_policy object (documented below).
FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the EFS file system.
backupPolicy This property is required. BackupPolicyBackupPolicy
A backup_policy object (documented below).
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the EFS file system.
backupPolicy This property is required. BackupPolicyBackupPolicy
A backup_policy object (documented below).
fileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the EFS file system.
backup_policy This property is required. BackupPolicyBackupPolicyArgs
A backup_policy object (documented below).
file_system_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the EFS file system.
backupPolicy This property is required. Property Map
A backup_policy object (documented below).
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the EFS file system.

Outputs

All input properties are implicitly available as output properties. Additionally, the BackupPolicy 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 BackupPolicy Resource

Get an existing BackupPolicy 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?: BackupPolicyState, opts?: CustomResourceOptions): BackupPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backup_policy: Optional[BackupPolicyBackupPolicyArgs] = None,
        file_system_id: Optional[str] = None) -> BackupPolicy
func GetBackupPolicy(ctx *Context, name string, id IDInput, state *BackupPolicyState, opts ...ResourceOption) (*BackupPolicy, error)
public static BackupPolicy Get(string name, Input<string> id, BackupPolicyState? state, CustomResourceOptions? opts = null)
public static BackupPolicy get(String name, Output<String> id, BackupPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:efs:BackupPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
BackupPolicyDetails BackupPolicyBackupPolicy
A backup_policy object (documented below).
FileSystemId Changes to this property will trigger replacement. string
The ID of the EFS file system.
BackupPolicy BackupPolicyBackupPolicyArgs
A backup_policy object (documented below).
FileSystemId Changes to this property will trigger replacement. string
The ID of the EFS file system.
backupPolicy BackupPolicyBackupPolicy
A backup_policy object (documented below).
fileSystemId Changes to this property will trigger replacement. String
The ID of the EFS file system.
backupPolicy BackupPolicyBackupPolicy
A backup_policy object (documented below).
fileSystemId Changes to this property will trigger replacement. string
The ID of the EFS file system.
backup_policy BackupPolicyBackupPolicyArgs
A backup_policy object (documented below).
file_system_id Changes to this property will trigger replacement. str
The ID of the EFS file system.
backupPolicy Property Map
A backup_policy object (documented below).
fileSystemId Changes to this property will trigger replacement. String
The ID of the EFS file system.

Supporting Types

BackupPolicyBackupPolicy
, BackupPolicyBackupPolicyArgs

Status This property is required. string
A status of the backup policy. Valid values: ENABLED, DISABLED.
Status This property is required. string
A status of the backup policy. Valid values: ENABLED, DISABLED.
status This property is required. String
A status of the backup policy. Valid values: ENABLED, DISABLED.
status This property is required. string
A status of the backup policy. Valid values: ENABLED, DISABLED.
status This property is required. str
A status of the backup policy. Valid values: ENABLED, DISABLED.
status This property is required. String
A status of the backup policy. Valid values: ENABLED, DISABLED.

Import

Using pulumi import, import the EFS backup policies using the id. For example:

$ pulumi import aws:efs/backupPolicy:BackupPolicy example fs-6fa144c6
Copy

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.