Routine Maintenance

Helpful Tasks

Finding the Autoscaling Group Name

For several maintenance operations it may be necessary to know the Autoscaling Group name. Use the following steps to find it:

  • Using the AWS Console, it is displayed in the Outputs tab of the stack you created in Launching the CloudFormation Stack

  • Using AWS CLI:

    aws cloudformation describe-stacks --stack-name stack-name --query "Stacks[].Outputs[?OutputKey == 'AutoScalingGroupName'].OutputValue" --output text

Finding the current Avantra Server’s Instance ID

For several maintenance operations it may be necessary to know the current EC2 instance ID of the Avantra Server. Since this instance is controlled by the Amazon EC2 Auto Scaling group the instance ID may change during the Avantra for AWS life-cycle.

Section Finding the Autoscaling Group Name describes how to find the Autoscaling Group Name.

  • Using the AWS Console, open Auto Scaling Groups and select the appropriate group. Switch to the Instances Tab and retrieve the Instance Id.

  • Using AWS CLI:

    aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name asg-name --query 'AutoScalingGroups[].Instances[].InstanceId' --output text

Finding the current Avantra Server’s Private IP

For several maintenance operations it may be necessary to know the current EC2 private IP address of the Avantra Server. Since this instance is controlled by the Amazon EC2 Auto Scaling group the private IP address may change during the Avantra for AWS life-cycle.

Use Finding the current Avantra Server’s Instance ID to retrieve the instance ID.

  • Using the AWS Console, open Instances, filter for the appropriate Instance ID and find the private IP address in field Private IPs of the Description tab.

  • Using AWS CLI:

    aws ec2 describe-instances --instance-ids instance-id --query 'Reservations[].Instances[].PrivateIpAddress' --output text

Stopping and Starting the Application

Stopping Avantra for AWS

  1. Suspend the Auto Scaling Group. See Finding the Autoscaling Group Name first.

    This step is essential! If you stop the application without suspending Auto Scaling before, the instance may be terminated and a new one will be launched.
    • Using the AWS Console, open Auto Scaling Groups and select the appropriate group.

      • On the Details tab, choose Edit.

      • For Suspended Processes, select all available processes.

      • Push the Save button.

    • Using AWS CLI:

      aws autoscaling suspend-processes --auto-scaling-group-name asg-name
  2. Stop the application services on OS level

    • Using the AWS Systems Manager:

      1. Open the AWS Console and choose AWS Systems Manager Run Command. Push the Run Command button.

      2. In the search box beyond Command document enter

        Document name prefix: Equals: AWS-RunShellScript

        and push the return key.

      3. In the field Command fill in

        sudo systemctl stop avantra-ui && sudo systemctl stop avantra-master
      4. In Targets, select manually the appropriate instance. See also Finding the current Avantra Server’s Instance ID.

      5. In Output Options, choose your desired way to capture the output. We recommend to remove the flag Enable writing to an S3 bucket and check CloudWatch output.

      6. Push the Run button.

    • Using SSH:

      1. Make sure you open the connection from the host allowed to connect by SSH as defined in the AllowedSshNetworkRange parameter of the AWS Cloud​Formation stack.

      2. Make sure you have the SSH key available defined in the SshKey parameter of the AWS Cloud​Formation stack.

      3. SSH to the user avantra on the private IP determined in Finding the current Avantra Server’s Private IP and run the following command:

        sudo systemctl stop avantra-ui && sudo systemctl stop avantra-master

Starting Avantra for AWS

  1. Start the application services on OS level

    • Using the AWS Systems Manager:

      1. Open the AWS Console and choose AWS Systems Manager Run Command. Push the Run Command button.

      2. In the search box beyond Command document enter

        Document name prefix: Equals: AWS-RunShellScript

        and push the return key.

      3. In the field Command fill in

        sudo systemctl start avantra-master && sudo systemctl start avantra-ui
      4. In Targets, select manually the appropriate instance. See also Finding the current Avantra Server’s Instance ID.

      5. In Output Options, choose your desired way to capture the output. We recommend to remove the flag Enable writing to an S3 bucket and check CloudWatch output.

      6. Push the Run button.

    • Using SSH:

      1. Make sure you open the connection from the host allowed to connect by SSH as defined in the AllowedSshNetworkRange parameter of the AWS Cloud​Formation stack.

      2. Make sure you have the SSH key available defined in the SshKey parameter of the AWS Cloud​Formation stack.

      3. SSH to the user avantra on the private IP determined in Finding the current Avantra Server’s Private IP and run the following command:

        sudo systemctl start avantra-master && sudo systemctl start avantra-ui
  2. Resume the Auto Scaling Group. See Finding the Autoscaling Group Name first.

    • Using the AWS Console, open Auto Scaling Groups and select the appropriate group.

      • On the Details tab, choose Edit.

      • For Suspended Processes, remove all selected processes.

      • Push the Save button.

    • Using AWS CLI:

      aws autoscaling resume-processes --auto-scaling-group-name asg-name

Product Updates

If you want to upgrade, you need to launch the AWS Cloud​Formation from the AWS Marketplace again. This applies to version updates as well as to scaling up the EC2 or the RDS instance.

Cross-Region Copies

In case you plan for a [Failover to a different region], you may want to copy certain resources into a different reason as part of your ongoing maintenance.

Most importantly, you should copy RDS snapshots. The vast majority of data of Avantra for AWS is kept in the database. In case you want to make a cross-region copy of the data stored in EFS, see section Cross-Region Copy of EFS Data.

Cross-Region Copy of RDS Snapshots

  • Using the AWS Console, open Amazon RDS Snapshots

    • Choose the AWS Region you have deployed Avantra for AWS into.

    • Select the desired snapshot and choose Actions  Copy Snapshot.

    • Choose the Destination Region and if or if not to Copy Tags.

    • Push the Copy Snapshot button.

  • Using AWS CLI: Let db-instance-identifier be the hostname part of the Rds Endpoint as displayed in the Outputs tab of the AWS Cloud​Formation stack, and source-region the AWS region you have deployed Avantra for AWS into:

    • The following commands lists all available snapshots, sorted by time:

      aws --region source-region rds describe-db-snapshots --db-instance-identifier  db-instance-identifier --query 'sort_by(DBSnapshots,&SnapshotCreateTime)[].[DBSnapshotArn,SnapshotCreateTime]'
    • The following copies a snapshot (identified by the DB Snapshot ARN as listed above) to the destination-region:

aws --region **destination-region** rds copy-db-snapshot --source-db-snapshot-identifier **snapshot-arn** --target-db-snapshot-identifier **target-snapshot-name** --copy-tags
  • The following copies the latest RDS DB Snapshot from source-region to destination-region (on Linux and macOS):

    SOURCE=$(aws --region source-region rds describe-db-snapshots \
        --db-instance-identifier db-instance-identifier \
        --query 'sort_by(DBSnapshots,&SnapshotCreateTime)[-1].DBSnapshotArn' \
        --output text) \
        && \
        aws --region destination-region rds copy-db-snapshot \
        --source-db-snapshot-identifier $SOURCE \
        --target-db-snapshot-identifier ${SOURCE##*:}-copy \
        --copy-tags
  • copies the latest RDS DB Snapshot from source-region to destination-region, retaining only a single snapshot (i.e. deletes the old copied snapshot first, on Linux and macOS):

    SOURCE=$(aws --region source-region rds describe-db-snapshots \
        --db-instance-identifier db-instance-identifier \
        --query 'sort_by(DBSnapshots,&SnapshotCreateTime)[-1].DBSnapshotArn' \
        --output text) \
        && \
        aws --region destination-region rds delete-db-snapshot \
        --db-snapshot-identifier avantra-snapshot-copy \
        ; \
        aws --region destination-region rds copy-db-snapshot \
        --source-db-snapshot-identifier $SOURCE \
        --target-db-snapshot-identifier avantra-snapshot-copy \
        --copy-tags

    You may use something like avantra-snapshot-$(date +%a) as snapshot identifier for the copied snapshot to keep one week of copied snapshots, if you run the above command on a daily basis.

If you had the AWS Cloud​Formation create the instance profile, or you created the instance profile yourself as described in Instance Profile, you can run the above AWS CLI from the EC2 instance. Even more, you can use the AWS Systems Manager to create a Maintenance Window and schedule periodically commands (Run command tasks) to copy snapshots.

Cross-Region Copy of EFS Data

The recommended way to copy EFS data across regions probably is the AWS Data Sync service. But, it imposes way too much overhead for using it only to copy the limited amount of data usually installed in /opt/avantra/.xandria that really would be required in a cross-region failover scenario.

We outline a leaner solution that you can customize to your needs: Using AWS CLI and the s3 sync option to copy the contents of /opt/avantra/.xandria to an Amazon S3 bucket.

  • Create an Amazon S3 bucket. Either create it in the AWS Region you deploy Avantra for AWS into an replicate it to a bucket in another region that serves for disaster recovery purposes. Or create it directly in the other region.

  • You may enable versioning on the bucket and deploy a life-cycle policy to clean up previous versions.

  • Make sure you allow the IAM role corresponding to the Instance Profile ARN of the AWS Cloud​Formation stack access to the bucket.

  • Run the following command on the EC2 instance to synchronize the files:

    aws s3 sync /opt/avantra/.xandria s3://your-bucket
If you had the AWS Cloud​Formation create the instance profile, or you created the instance profile yourself as described in Instance Profile, you can run the above AWS CLI from the EC2 instance. Even more, you can use the AWS Systems Manager to create a Maintenance Window and schedule periodically commands (Run command tasks) to sync files.