AWS EC2 Monitoring Extension

AWS EC2 Monitoring Extension


Use Case

Captures EC2 instances statistics from Amazon CloudWatch and displays them in the AppDynamics Metric Browser.


This extension works only with the standalone machine agent.


Note: By default, the Machine agent can only send a fixed number of metrics to the controller. This extension can potentially report thousands of metrics, so to change this limit, please follow the instructions mentioned here.



  1. Download and unzip AWSEC2Monitor-<version>.zip into <machine_agent_dir>/monitors/
  2. Edit config.yaml file in AWSEC2Monitor/conf and provide the required configuration (see Configuration section)
  3. Restart the Machine Agent.





Note: Please avoid using tab (\t) when editing yaml files. You may want to validate the yaml file using a yaml validator.


accountsFields under this section can be repeated for multiple accounts config
awsAccessKeyAWS Access Key
awsSecretKeyAWS Secret Key
displayAccountNameDisplay name used in metric path"MyAWSEC2"
regionsRegions where ec2 is registeredAllowed values:
enableDecryptionIf set to "true", then all aws credentials provided (access key and secret key) will be decrypted - see AWS Credentials Encryption section
decryptionKeyThe key used when encypting the credentials
hostThe proxy host (must also specify port)
portThe proxy port (must also specify host)
usernameThe proxy username (optional)
passwordThe proxy password (optional)
useNameInMetricsSet to "true" if you wish to display the instance name rather than instance Id in the metric browser. Note, name must be configured in your EC2 instance.
tagFilterNameDo not change. Internal setting to retrieve instance name.
tagKeyDo not change. Internal setting to retrieve instance name.
metricTypesFields under this section can be repeated for multiple metric types override
metricNameThe metric name"CPUUtilization"
statTypeThe statistic typeAllowed values:
excludeMetricsMetrics to exclude - supports regex"CPUUtilization",
startTimeInMinsBeforeNowThe no of mins to deduct from current time for start time of query5
endTimeInMinsBeforeNowThe no of mins to deduct from current time for end time of query.
Note, this must be less than startTimeInMinsBeforeNow
maxErrorRetrySizeThe max number of retry attempts for failed retryable requests1
noOfAccountThreadsThe no of threads to process multiple accounts concurrently3
noOfRegionThreadsPerAccountThe no of threads to process multiple regions per account concurrently3
noOfMetricThreadsPerRegionThe no of threads to process multiple metrics per region concurrently3
metricPrefixThe path prefix for viewing metrics in the metric browser."Custom Metrics|Amazon EC2|"


Below is an example config for monitoring multiple accounts and regions:

  - awsAccessKey: "XXXXXXXX1"
    awsSecretKey: "XXXXXXXXXX1"
    displayAccountName: "TestAccount_1"
    regions: ["us-east-1","us-west-1","us-west-2"]

  - awsAccessKey: "XXXXXXXX2"
    awsSecretKey: "XXXXXXXXXX2"
    displayAccountName: "TestAccount_2"
    regions: ["eu-central-1","eu-west-1"]

    # Regions where ec2 is registered
    # Allowed values: ap-southeast-1, ap-southeast-2, ap-northeast-1, eu-central-1,
    #                 us-east-1, eu-west-1, us-west-1, us-west-2, sa-east-1
    regions: ["us-east-1"]
    enableDecryption: "false"
    useNameInMetrics: "false"
    tagFilterName: "tag-key"
    tagKey: "Name"

#EC2 instance for which you want to get the metrics. This is useful when you want to monitor only 1 instance. Keep this empty if you want to monitor all the available instances.
#Only 1 instance id is acceptable here as AWS CloudWatch API does not support muliple dimension values for the dimension

#Filter the instances by tag name. tagValue is optional. if tagValue is not provided, we will fetch all the instances with the tagName.
  - name: "Name"
    value: ["tag1", "tag2", "tag3"]

# Global metrics config for all accounts

    # By default, all metrics retrieved from cloudwatch are 'Average' values.	
    # This option allows you to override the metric type. 
    # metricName supports regex
    # Allowed statTypes are: ave, max, min, sum, samplecount
    # Note: Irrespective of the metric type, value will still be reported as
    # Observed value to the Controller
      - metricName: "CPUUtilization"
        statType: "ave"

    excludeMetrics: [".*Disk.*"]

      startTimeInMinsBeforeNow: 5
      endTimeInMinsBeforeNow: 0

    # The max number of retry attempts for failed retryable requests 
    # (ex: 5xx error responses from a service) or throttling errors
    maxErrorRetrySize: 0

  noOfAccountThreads: 3
  noOfRegionThreadsPerAccount: 3
  noOfMetricThreadsPerRegion: 3

#prefix used to show up metrics in AppDynamics. This will create this metric in all the tiers, under this path
#metricPrefix: "Custom Metrics|Amazon EC2|"

#This will create it in specific Tier/Component. Make sure to replace  with the appropriate one from your environment.
#To find the  in your environment, please follow the screenshot
metricPrefix: "Server|Component:|Custom Metrics|Amazon EC2|"


AWS Credentials Encryption

To set an encrypted awsAccessKey and awsSecretKey in config.yaml, follow the steps below:

  1. Download the util jar to encrypt the AWS Credentials from here.
  2. Run command:

    java -cp appd-exts-commons-1.1.2.jar com.appdynamics.extensions.crypto.Encryptor EncryptionKey CredentialToEncrypt
    For example: 
    java -cp "appd-exts-commons-1.1.2.jar" com.appdynamics.extensions.crypto.Encryptor test myAwsAccessKey
    java -cp "appd-exts-commons-1.1.2.jar" com.appdynamics.extensions.crypto.Encryptor test myAwsSecretKey
  3. Set the decryptionKey field in config.yaml with the encryption key used, as well as the resulting encrypted awsAccessKey and awsSecretKey in their respective fields.




Typical metric path: Application Infrastructure Performance|<Tier>|Custom Metrics|Amazon EC2|<Account Name>|<Region>|Instance|<instance id or name> followed by the metrics defined in the link below:

  • EC2 Metrics


    Always feel free to fork and contribute any changes directly via GitHub.



    For any questions or feature request, please contact AppDynamics Center of Excellence.


    Agent Compatiblity3.7+
    Last Update28 March 2018



     Changes in versions:
    1.0.4: Adding support for Instance profile, additional filtering
    1.0.5: Updating Licenses
    1.0.6: Fixed WstxInputFactory class loading issue in MahcineAgent 4.4