AWS Elastic Beanstalk is a service provided by Amazon Web Services that gives you the option of deploying and auto-scaling applications and services. Using a predefined
.ebextensions configuration file you can modify your deployment by supplying additional resources or packages. For more information, see the AWS documentation.
You can prepare configurations where Dynatrace OneAgent is already part of your application deployment. In such cases you won't have to manually install OneAgent or restart servers to enable service monitoring.
What you need
- Dynatrace OneAgent download link (Windows or Linux).
- Access to your AWS Console.
Get the Dynatrace OneAgent download
See the section on downloading the Dynatrace OneAgent installer for specific instructions on downloading Dynatrace OneAgent for installation with Elastic Beanstalk.
For Windows installations, click the Windows button. Then in the Download Dynatrace OneAgent for Windows page, select the Download MSI package option.
For Linux installations, follow the Linux installation instructions.
Create a configuration to install Dynatrace OneAgent
Because the specifics of this type of installation depend heavily on user customizations, we can't provide a simple set of steps that will work in all scenarios. Following is only a brief overview of the entire process, with examples that will help you create your own deployment.
It's best to split plugin configuration into two files, one for downloading the Dynatrace OneAgent installer and a second for invoking the installation and post-installation tasks. Note that the Elastic Beanstalk plugin script file names are important—the Amazon interpreter executes these in alphabetical order.
Create the download configuration file and save it with the name
0dynatraceDownload.config. The configuration file needs to contain a
files section where you must define:
- Download path and target file name, for example
- Proper user rights settings
- The Dynatrace OneAgent download URL you copied to your text editor.
files: "/tmp/dynatraceinstall.sh": mode: "000755" owner: root group: root source: "https://abcdefghij.live.dynatrace.com/installer/agent/unix/latest/abc1234567890"
Create a file called
1dynatraceInstallAndPost.config to execute the Dynatrace OneAgent installer and perform other tasks, such as service restart.
The following script checks for an existing Dynatrace OneAgent setup, executes installation from the
/tmp directory if no OneAgent is found, and restarts
commands: install_dynatrace_oneagent: command: "[ -d /opt/dynatrace/oneagent ] || /tmp/Dynatrace-OneAgent.sh" cwd: /tmp restart_httpd: command: service httpd restart
Create a configuration file for downloading the installer and save it as
0dynatraceDownload.config. The file needs to contain a
sources section where you must define:
* Download destination (for example, your desktop) * Download URL
The following script excerpt example downloads the Dynatrace OneAgent installer to
/OneAgent. The environment URL and the API token in this example must be replaced by your environment URL and API token.
sources: "C:/OneAgent": https://abcdefghij.live.dynatrace.com/api/v1/deployment/installer/agent/windows/default-unattended/latest?Api-Token=abcdefghijklmnopqrstu&arch=x86&flavor=default
The configuration file must also contain the installation command for Dynatrace OneAgent in the
The following script excerpt example executes the installer from the administrator's desktop folder in quiet mode (i.e., with no graphical user interface). The
waitAfterCompletion sleep time of five minutes (300 seconds) helps to ensure the installation has ended.
commands: install_oneagent: command: "C:/OneAgent/install.bat /quiet /qn" waitAfterCompletion: 300
You don't need to add extra commands following Dynatrace OneAgent installation. Amazon will restart IIS for you once you've successfully uploaded all your application files.
Extend your configuration
For convenience, you can also include steps to download Dynatrace OneAgent in your configuration.
This Linux script example includes the Dynatrace OneAgent download in the configuration. While this is necessary for the first installation of Dynatrace OneAgent, this may substantially extend future application updates, because you download Dynatrace OneAgent each time.
You can improve your Beanstalk configuration by adding a check for an existing Dynatrace OneAgent installation and have your scripts download Dynatrace OneAgent only when it isn't found on the system.
Look at the following Linux configurations example carefully before creating your own scripts. Take care in formatting and escaping special characters. The Amazon interpreter is sensitive to syntax errors.
files: "/tmp/dynatraceElasticBeanstalk.sh": mode: "000755" owner: root group: root content: | #!/bin/bash if [ ! -d /opt/dynatrace/oneagent ]; then wget -O /tmp/Dynatrace-OneAgent.sh "https://yyyyyyyy.live.dynatrace.com/api/v1/deployment/installer/agent/unix/default/latest?Api-Token=xxxxxxxxxxGw&arch=x86" chmod 755 /tmp/Dynatrace-OneAgent.sh sudo chown root:root /tmp/Dynatrace-OneAgent.sh sudo /tmp/Dynatrace-OneAgent.sh commands: install_dynatrace: command: /tmp/dynatraceinstall.sh restart_nginx: command: service nginx restart ignoreErrors: true