Quickly identify the Acquia subscription containing your site

If you have many Acquia subscriptions for your sites, sometimes you need a quick way to find where a site lives. Traditionally, you would login to insight.acquia.com and navigate through each subscriptions domain list searching each page for a match. Or, if you are technical savvy you could even write a script against their Cloud API to dump and catalog these mappings. Who has time for that?

All Acquia-hosted domains have what's called an "Acquia Monitor" endpoint, which I believe is used for gathering site performance data to power the various charts and stats you see in insight.acquia.com. You, too, can leverage this same endpoint to get the subscription name for the site. Recently, Acquia tightened up security for this endpoint so you will need to configure a browser extension to conditionally send an authentication header. I show you how to do this below.

  1. Install the ModHeader extension for Google Chrome (https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpg...) . If you don't use Google Chrome, there's probably an equivalent extension you can use.
     
  2. Once installed, configure a Request Header named "X-Acquia-Monitoring". The value will be a key, which you can find on any one of your server's Apache configuration files. To find the key, run this command on your Acquia server:

    grep X-Acquia-Monitoring /etc/apache2/conf.d/*
     
  3. After you setup ModHeader in Chrome it should look something like this:


     
  4. Then setup a filter in ModHeader to only send this header on requests for yoursite.com/ACQUIA_MONITOR


     
  5. ModHeader setup is complete. Now go to one of your Acquia-hosted sites in Chrome and append /ACQUIA_MONITOR; you will see information like this returned (anonymized):
     
    site=subscription123
    db=subscriptiondb
    db_server=1234
    db_connect=0.0674
    db_query=0.0292
    hostname=web-890182903821.prod.hosting.acquia.com
    opcache_free=54.52
    opcache_total=128.00
    opcache_used=73.48
    gfs_write=0.0732
    gfs_read=0.0522
    total=0.2273
    success
    
    
  6. The most important tidbits above are the site and db values. The site value is like a machine name for the subscription, so the subscription can be gleaned from that. Also, this formulates the first part of your drush remote alias. If you downloaded aliases from Acquia, and assuming you have access to the servers, you could do:

    drush @subscription123.dev ssh

    ... and that would drop you into the subscription's dev environment. Instead of ".dev", append ".test" to run the drush command against Staging and ".prod" for Production.

I hope you found this post helpful. If you have a lot of subscriptions this is a super easy way to locate the site's subscription. Enjoy!