...
Code Block |
---|
function New-TemporaryDirectory { $parent = [System.IO.Path]::GetTempPath() [string]$name = [System.Guid]::NewGuid() New-Item -ItemType Directory -Path (Join-Path $parent $name) } $url = "\\10.0.0.69\d\breeze-agent.exe" $tmp_dir = New-TemporaryDirectory $agent_sfx = "$tmp_dir\breeze-agent.exe" # download agent installer (New-Object System.Net.WebClient).DownloadFile($url, $agent_sfx) # install agent Start-Process $agent_sfx -ArgumentList '-gm2' -NoNewWindow -Wait # clean up Remove-Item "$tmp_dir" -recurse |
AWS EC2 User Data script
You can install Breeze agent on AWS EC2 instance's using 'EC2 instance user data' during the initial launch of the instance. The script involves the following steps:
Download the agent installer
Unpack the installer (for Linux OSs)
Run the installer
Since the installer file is customer-related and may contain vulnerable data, it may be challenging to define a secure location where it will be placed and accessible for EC2 instance. Upload the installer file into the location where it will be publicly available for short duration. In our use case we will generate a Presigned AWS S3 object URL for the S3 bucket storing the installer file.
Upload the Breeze installer file(s) to AWS S3 Bucket
1. Download Breeze Agent installers from Cloudaware CMDB.
2. Upload them to the S3 Bucket.
Generate a Presigned object URL for each installer
AWS CLI tool and preconfigured profile in your AWS account are required. Use this line command to generates Presigned object URL:
Code Block |
---|
~$ aws s3 presign s3://breeze-agents/breeze-agent.linux.tgz |
Sample output:
Default lifetime for this URL is 1 hour (or 3600 seconds). You can manually define the URL lifetime by adding --expires-in <time in seconds>
option:
Code Block |
---|
~$ aws s3 presign s3://breeze-agents/breeze-agent.linux.tgz --expires-in 300 |
Prepare the user data script and launch the instance
Once agent installers are ready, add the script to EC2 instance user data to install Breeze Agent. Replace the presigned URL in the script by the one you generated and insert it into the User data section when launching the instance.
Linux:
Code Block |
---|
#!/bin/bash
URL='<presigned URL to agent installer in your S3 bucket>'
# download agent installer
curl $URL -o /tmp/breeze-agent.tgz
# unpack agent installer
sudo tar -xf /tmp/breeze-agent.tgz -C /tmp
# install agent
sudo /tmp/breeze-agent/install.sh
|
Windows:
Code Block |
---|
<powershell>
function New-TemporaryDirectory {
$parent = [System.IO.Path]::GetTempPath()
[string]$name = [System.Guid]::NewGuid()
New-Item -ItemType Directory -Path (Join-Path $parent $name)
}
$url = "<presigned URL to agent installer in your S3 bucket>"
$tmp_dir = New-TemporaryDirectory
$agent_sfx = "$tmp_dir\breeze-agent.exe"
# download agent installer
(New-Object System.Net.WebClient).DownloadFile($url, $agent_sfx)
# install agent
Start-Process $agent_sfx -ArgumentList '-gm2' -NoNewWindow -Wait
# clean up
Remove-Item "$tmp_dir" -recurse
</powershell>
|
Info |
---|
Windows must have Powershell preinstalled. This script will work for all Windows Server versions starting 2012 R2 and newer. |
Proxy support
To add the proxy support to Breeze agent, you need to edit the startup script.
...