How to enable auto scaling for plugins in AWS

How to enable auto scaling for plugins in AWS

This knowledge base explains how to enable auto scaling for Site24x7 plugins on AWS using an AMI-based approach.

In this example, we use a MongoDB monitoring plugin, where the required setup is baked into the EC2 launch process. When instances scale automatically using a launch template, the Site24x7 agent and plugin are installed and configured without manual intervention.
This ensures that new EC2 instances created through Auto Scaling Groups are monitored automatically as soon as they come online.

What the script does

The attached example startup script performs the following actions during instance launch:
  1. Installs the Site24x7 Linux agent.
  2. Downloads the required Site24x7 MongoDB plugin files. Ensure that access to the domain https://github.com/site24x7/plugins is allowed in your firewall or security rules so the required plugin files can be downloaded.
  3. Configures the plugin using the MongoDB connection details provided by the user.
This script is executed automatically when an EC2 instance is launched using the configured launch template.

Configuration required

Before using the script, you must update it with your Site24x7 device key and MongoDB server details.

Update the following parameters in the script:
  1. host = "localhost"
  2. port = "27017"
  3. username = "None"
  4. password = "None"
  5. dbname = "mydatabase"
  6. authdb = "admin"
  7. tls = "False"
  8. tlscertificatekeyfile = "None"
  9. tlscertificatekeyfilepassword = "None"
  10. tlsallowinvalidcertificates = "True"
Make sure the values match your MongoDB deployment and authentication setup.

Updating the AWS launch template

Once the script is updated with the correct details, follow these steps to attach it to your AWS launch template.
  1. Log in to the AWS Management Console.
  2. Navigate to EC2.
  3. Click Launch templates.
  4. Edit the required launch template.
  5. Under Advanced Details, upload or paste the updated startup script.
  6. Save the changes.
  7. Use this launch template when creating or updating your EC2 instances.


Any EC2 instance launched using this template will:
  1. Automatically install the Site24x7 agent.
  2. Configure and enable the MongoDB plugin.
  3. Start monitoring without any manual setup.
This enables seamless monitoring even when instances are scaled up or replaced automatically.

    • Related Articles

    • Tag-based service discovery for AWS resources

      While you integrate your AWS account with Site24x7, add tags that enable you to control which AWS resource must get discovered and monitor them. Perform Include and Exclude tags operation simultaneously along with an OR/AND logic to filter the AWS ...
    • Resolving the Issue: 'Applications suspended due to auto-suspended instances'

      Why were applications suspended automatically? Previously, applications were automatically suspended when all their instances were scaled down. How to resolve this? If an application is marked as suspended while some instances are still actively ...
    • How is auto scaling handled by the APM Insight agent?

      When applications are scaling up, a request for creating a new instance comes from the agent. Depending upon the license availability, the new instance may be scaled up for monitoring. Let's say your license limit allows you to monitor 3 advanced ...
    • AWS Metric Profile - When new metrics or monitors are added.

      CASE 1: When new metrics are added for services. Whenever new metrics are added for an Amazon Web Services (AWS) resource, they'll be automatically added to the existing Metric Profile created for an account. Let's consider the example of S3 buckets ...
    • How to provide ReadOnly access to your AWS resources via the AWS IAM console?

      Grant access to your AWS account Site24x7 makes programmatic API calls to your AWS resources to collect performance metrics and metadata. For this to occur, you (AWS account holder) need to grant access and connect your AWS account with Site24x7. An ...