# EFS Backup Solution # # template for efs-backup-solution 'Restore' # **DO NOT DELETE** # # author: aws-solutions-builder@ AWSTemplateFormatVersion: '2010-09-09' Description: (SO0031R) - EFS-to-EFS Backup Solution template. Version %%VERSION%% Parameters: # Source EFS on which restore will be performed SrcEFS: Description: Source EFS Id Type: String AllowedPattern: .+ ConstraintDescription: cannot be blank # Backup EFS from where restore will be performed DstEFS: Description: Backup EFS Id Type: String AllowedPattern: .+ ConstraintDescription: cannot be blank # Interval tag which you want to restore IntervalTag: Description: Interval label for backup which you want to restore Type: String Default: daily AllowedValues: - daily - weekly - monthly # Backup Number that you want to restore BackupNum: Description: Backup number you want to restore, 0 being most recent Type: Number Default: 0 # Folder identifier for backup copy to be restored FolderLabel: Description: Folder on destination efs where backups reside Type: String Default: efs-backup # Source EFS Prefix where you want files to be restored RestorePrefix: Description: Source prefix for restore Type: String Default: '/' AllowedPattern: .+ ConstraintDescription: cannot be blank # Sub directory that you want to restore RestoreSubDir: Description: Sub directory for restore, eg. /dir_x/; must have trailing '/'. Leave default if you want entire backup to be restored. Type: String Default: '/' AllowedPattern: (.+)*/ ConstraintDescription: must have trailing '/' # VPC where the source/destination EFS resides VpcId: Description: VPC where the source/destination EFS mount targets reside Type: AWS::EC2::VPC::Id AllowedPattern: .+ ConstraintDescription: cannot be blank # List of SubnetIDs for EC2, must be same AZ as of EFS Mount Targets (Choose 2) Subnets: Description: List of SubnetIDs for EC2, must be same AZ as of EFS Mount Targets (Choose 2). Must specify subnets in different AZs. Type: List AllowedPattern: .+ ConstraintDescription: cannot be blank SecurityGroupId: Description: The ID of an existing EC2 SecurityGroup in your Virtual Private Cloud (VPC), which should provide access to your existing EFS Type: AWS::EC2::SecurityGroup::Id AllowedPattern: .+ ConstraintDescription: cannot be blank # Bucket where restore logs will be saved RestoreLogBucket: Description: Bucket to store restore logs (use the same bucket as Backup) Type: String AllowedPattern: .+ ConstraintDescription: cannot be blank # Email for restore notifications Email: Description: Email for restore notifications Type: String AllowedPattern: .+ ConstraintDescription: cannot be blank # CW Dashboard Dashboard: Description: Do you want dashboard for your metrics? Type: String AllowedValues: - "Yes" - "No" Default: "Yes" Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Restore Configuration Parameters: - SrcEFS - DstEFS - IntervalTag - BackupNum - FolderLabel - RestorePrefix - RestoreSubDir - RestoreLogBucket - Label: default: EC2 Configuration Parameters: - VpcId - Subnets - SecurityGroupId - Label: default: Notification & Dashboard Parameters: - Email - Dashboard ParameterLabels: IntervalTag: default: Interval Label DstEFS: default: Backup EFS Subnets: default: Subnet IDs SrcEFS: default: Source EFS BackupNum: default: Backup Number FolderLabel: default: Folder Label RestorePrefix: default: Restore Prefix RestoreSubDir: default: Restore Subdirectory VpcId: default: VPC ID SecurityGroupId: default: Security Group ID RestoreLogBucket: default: Restore Log Bucket Mappings: Map: send-data: {"SendAnonymousData": "Yes"} c5.xlarge: {"Arch":"HVM64"} us-east-1: {"InstanceSize":"c5.xlarge"} us-east-2: {"InstanceSize":"c5.xlarge"} us-west-1: {"InstanceSize":"c5.xlarge"} us-west-2: {"InstanceSize":"c5.xlarge"} ca-central-1: {"InstanceSize":"c5.xlarge"} eu-west-1: {"InstanceSize":"c5.xlarge"} eu-central-1: {"InstanceSize":"c5.xlarge"} eu-west-2: {"InstanceSize":"c5.xlarge"} ap-southeast-1: {"InstanceSize":"c5.xlarge"} ap-southeast-2: {"InstanceSize":"c5.xlarge"} ap-northeast-1: {"InstanceSize":"c5.xlarge"} ap-northeast-2: {"InstanceSize":"c5.xlarge"} ap-south-1: {"InstanceSize":"c5.xlarge"} sa-east-1: {"InstanceSize":"c5.xlarge"} SourceCode: General: S3Bucket: "%%BUCKET_NAME%%" KeyPrefix: "%%SOLUTION_NAME%%/%%VERSION%%" Conditions: DashboardOpt: !Equals [ !Ref Dashboard, "Yes" ] Resources: # # EFS resources # [EFSSecurityGroup, EFSIngressRule, RestoreInstanceLaunchConfig, RestoreAutoScalingGroup] # EFSSecurityGroup: Type: AWS::EC2::SecurityGroup Metadata: cfn_nag: rules_to_suppress: - id: F1000 reason: "allowing all egress traffic" Properties: VpcId: !Sub ${VpcId} GroupDescription: !Sub SG for EFS backup solution ${AWS::StackName} EFSIngressRule: Type: AWS::EC2::SecurityGroupIngress Metadata: cfn_nag: rules_to_suppress: - id: W36 reason: "adding description causes replace during CFN update, causing a stack creation error" - id: W42 reason: Allowing ICMP within the same security group only Properties: FromPort: -1 GroupId: !Sub ${EFSSecurityGroup} IpProtocol: -1 SourceSecurityGroupId: !Sub ${EFSSecurityGroup} ToPort: -1 RestoreInstanceLaunchConfig: Type: AWS::AutoScaling::LaunchConfiguration Properties: ImageId: !GetAtt AMIInfo.Id SecurityGroups: - !Sub ${EFSSecurityGroup} - !Ref SecurityGroupId InstanceType: !FindInMap [Map, !Ref "AWS::Region", "InstanceSize"] IamInstanceProfile: !Sub ${InstanceProfile} UserData: # download and run efs-restore script # 12/28/2018 - EFS-21432 - adding retries for downloads Fn::Base64: !Sub - | #!/bin/bash # V4488716 - 08/03/2018 - Support custom DHCP option # https://github.com/awslabs/efs-backup/issues/1 cat <