Cloud and specifically AWS, is an environment based largely on automation. Since all the functionality is available via an API, scripts can be used to deploy and manage applications, servers, and complete environments. There are very popular tools available to help with configuring and deploying these environments, like Chef and Puppet.
N2WS allows configuring backup using automation tools by utilizing AWS tags. By tagging a resource (EC2 instance, EBS volume, EFS, DynamoDB, RDS instance, Aurora Cluster, or Redshift cluster), N2WS can be notified of what to do with this resource, and there is no need to use the UI. To tag Aurora clusters, tag one of the cluster’s DB instances, and N2WS will pick it up and back up the entire cluster.
Since tagging is a basic functionality of AWS, it can be easily performed via the API and scripts.
To automate backup management for a resource, you can add a tag to that resource named
cpm backup (lower case with a space). N2WS will identify this tag and parse its content. In this tag you will be able to specify whether to:
Ignore the resource and remove it from all backup policies.
Add the resource to a policy or list of policies.
Create a new policy, based on an existing one (template), and then add the resource to it.
Following is a summary table of all
cpm backup tag values:
cpm backup Tag Value
Add resource to existing backup policy. See 14.1.1.
policy1 policy2 policy3
Create policy from a template. See 14.1.2.
Set backup options for EC2 instances. See 14.1.3.
only-snaps (create AMIs without reboot)
only-amis-reboot (create AMIs with reboot)
app-aware (Windows instance backup agent is same as snapshot and AMI options)
app-aware-vss (Enable application consistent with VSS)
app-aware-script (Enable application consistent without VSS)
Set backup options for EFS instances. N2WS will override EFS configuration with tag values. See 14.1.4.
vault role_arn cold_opt
Default (example) ARN of role Lifecycle transition: N, D, W, M, Y Integer for D,W,M,Y only When resource expires: P (Policy Gen), N, D, W, M, Y Integer for D, W, M, Y only
Remove resource from all policies. See 14.1.5.
Exclude volumes from backup. See 14.1.6.
Note: Tagged instances are excluded from the Exclude volumes option in General Settings for Tag Scan. Tagged instances are only excluded with the ‘#exclude’ tag.
To add a resource (e.g. an EC2 instance) to an existing backup policy, all you need to do is to create the tag for this resource and specify the policy name (e.g. policy1):
key:cpm backup, value:policy1
To add the resource to multiple policies all you need to do is to add a list of policy names, separated by spaces:
policy1 policy2 policy3
To create a new policy and to add the resource to it, add a new policy name with a name of an existing policy which will serve as a template (separated by semicolon):
tag value: new_policy1:existing_policy1
You can also add multiple policy name pairs to create additional policies or create a policy (or policies) and to add the resource to an existing policy or policies.
When a new policy is created out of a template, it will take the following properties from it:
Number of generations
It will not inherit any backup targets, so you can use a real working policy as a template or an empty one.
For Script definitions:
If backup scripts are defined for the template policy, the new one will keep that definition but will not initially have any actual scripts. You are responsible to create those scripts. Since the N2WS server is accessible via SSH you can automate script creation. In any case, since scripts are required, the backups will have a failure status and will send alerts, so you will not forget about the need to create new scripts.
For Windows instances with a backup agent configured:
If that was the configuration of the original policy, the new instance (assuming it is a Windows instance) will also be assigned as the policy agent. However, since it does not have an authentication key, and since the agent needs to be installed and configured on the instance, the backups will have a failure status. Setting the new authentication key and installing the agent needs to be made manually.
Auto Target Removal for the new policy will always be set to yes and alert, regardless of the setting of the template policy. The basic assumption is that a policy created by a tag will automatically remove resources that do not exist anymore, which is the equivalent as if their tag was deleted.
When adding an instance to a policy, or creating a new policy from template, you may make a few decisions about the instance:
To create snapshots only for this instance.
To create snapshots with an initial AMI.
To schedule AMI creation only.
If this option is not set, N2WS will assume the default:
Snapshots only for Linux.
Snapshots with initial AMI for Windows instances by adding a backup option after the policy name. The backup option can be one of the following values:
For example, with an existing policy:
policy1#only-snaps, or for a new policy based on template and setting AMI creation:
For a Windows instance, you can also define backup with app-aware, i.e. a backup agent. It is used the same as the snapshots and AMI options.
When adding the app-aware option, the agent is set to the default: VSS is enabled and backup scripts are disabled.
app-aware-vss - Enable application consistent with VSS.
app-aware-script - Enable application consistent without VSS.
Additional configurations need to be made manually, and not with the tag.
You can also combine the backup options:
EFS can be configured by creating the
cpm backup tag with the following values. In this case, N2WS will override the EFS configuration with the tag values:
ARN of role. Example:
Integer for D, W, M, Y only
When does resource expire:
Integer for D, W, M, Y only
cpm backup my_policy+vault=Default+exp_opt=D+exp_opt_val=1
N2WS will back up EFS to the default vault, and set its expiration date to 1 day.
By creating the
cpm backup tag with the value
no-backup (lower case), you can tell N2WS to ignore the resource and remove this resource from all policies. Also, see section 14.1.
N2WS can exclude a volume from an instance that is backed up on policy using the
cpm backup tag with
#exclude added to the end of the policy name value.
Add a tag to an instance that you want to back up:
Key = cpm backup; Value = policy_name1 policy_name2
Add a tag to volumes that you would like to exclude from being backed up:
Key = cpm backup; Value = policy_name1#exclude policy_name2#exclude
For example, if instance1 has 3 volumes and has a
cpm backup tag with the value
policy1, adding the
cpm backup tag with value
policy1#exclude to a volume will remove it from the policy.
The instance with the excluded volume(s) will be added automatically as a backup target to the policy, after running Scan Tag.
Custom Tags allow N2WS users to easily backup resources using any tag of their choice.
You can define any number of Custom Tags on a Policy definition.
Custom tags take precedence over cpm backup tags if both exist on a server.
Define Custom Tags with the Names and Values to match the Tags of AWS Resources to add to the Policy.
If a user-defined Custom Tag exists on an AWS resource, the resource will be automatically added to the Policy during the Tag Scan process. See section 14.3.
It is possible to match an AWS Resource Tag with an N2WS Tag Name or Value defined as a Prefix. For example, if the Tag Name ‘Department’ is defined as a Prefix, the following AWS resources that have a Tag Name starting with ‘Department’ will be added to the policy: ‘Department A’, ‘Departments’, and Department_3’.
To see which resources were added to backup, open the Tag Scan log (Show Log) and look for a Custom Tags match.
To create Custom Tags:
In the Policies tab, select a policy.
Select the More Options tab.
Turn on the Custom Tags toggle.
Define the Tag Name and Tag Value.
If the Name and/or Value is a prefix, select Name is Prefix .
Tag scanning can only be controlled by the admin/root user. When the scan is running, it will do so for all the users in the system but will only scan AWS accounts that have Scan Resources enabled. This setting is disabled by default. N2WS will automatically scan resources in all AWS regions.
In the General Settings tab, select the Tag Scan tab.
Select Scan Resources.
In the Tag Scan interval list, set the interval in hours for automatic scans.
To override the exclusion of volumes specified in the UI and to exclude instances tagged with
#exclude for the policy, select Exclude volumes. See section 9.6.
To initiate a tag scan immediately, select Scan Now.
To view the Last Scan, select Show Log.
If you do want automated scans to run, keep scanning enabled and set the interval in hours between scans using the General Settings screen. You will also need to enable Scan Resources for the relevant N2WS Accounts. See section 3.1.2.
The following topics should help guide you when developing tags.
There are potential issues you should try to avoid when managing your backup via tags:
The first is not to create contradictions between the tags content and manual configuration. If you tag a resource and it is added to a policy, and later you remove it from the policy manually, it may come back at the next tag scan. N2WS tries to warn you from such mistakes.
Policy name changes can also affect tag scanning. If you rename a policy, the policy name in the tag can be wrong. When renaming a policy, correct any relevant tag values.
When you open a policy that was created by a tag scan to edit it, you will see a message at the top of the dialog window: “* This policy was automatically added by tag scan”.
If the same AWS account is added as multiple accounts in N2WS, the same tags can be scanned multiple times, and the behaviour can become unpredictable. N2W Software generally discourages this practice. It is better to define an account once, and then allow delegates (section 18.4) access to it. If you added the same AWS account multiple times (even for different users), make sure only one of the accounts in N2WS has Scan Resources enabled in N2WS.
Sometimes you need to understand what happened during a tag scan, especially if the tag scan did not behave as expected, such as a policy was not created. In the General Settings screen, you can view the log of the last tag scan and see what happened during this scan, as well as any other problems, such as a problem parsing the tag value, that were encountered. Also, if the daily summary is enabled, new scan results from the last day will be listed in the summary.
Ensure tag format is correct. Tips for ensuring correct tag formats are:
When listing multiple policy names, make sure they are separated by spaces.
When creating new policy, verify using a colon ‘
:’ and not a semi-colon ‘
;’. The syntax is
Use a valid name for the new policy or it will not be created. An error message will be added to scan log.
Use correct names for existing/template policies.
Resource scanning order is NOT defined, so use policy names as existing/template only if you are sure that it exists in N2WS – defined manually or scanned previously.