This CloudFormation template creates a role for elastic-agent and attaches it to a newly created EC2 instance.
The EC2 instance has elastic-agent preinstalled in it using the fleet URL and enrollment token.
Install the Vulnerability Management integration on a new agent policy, you might have to check the "Display beta integrations" checkbox.
After you installed the integration you can install a new elastic-agent, you should keep the fleet URL and the enrollment token.
On cloudbeat repo, create a deploy/cloudformation/config.env file of the form:
STACK_NAME="<Unique stack name>" # john-qa-bc2-8-9-0-May28
FLEET_URL="<Elastic Agent Fleet URL>"
ENROLLMENT_TOKEN="<Elastic Agent Enrollment Token>"
ELASTIC_ARTIFACT_SERVER="https://artifacts.elastic.co/downloads/beats/elastic-agent" # Replace artifact URL with a pre-release version (BC or snapshot)
ELASTIC_AGENT_VERSION="<Elastic Agent Version>" # e.g: 8.8.0 | 8.8.0-SNAPSHOT
DEV.ALLOW_SSH=false # Set to true to allow SSH connections to the deployed instance
DEV.KEY_NAME="" # When SSH is allowed, you must provide the key name that will be used to ssh into the EC2
Run just deploy-cloudformation to create a CloudFormation stack with an elastic-agent that will automatically enroll to your fleet.
If the stack was created successfully but elastic-agent didn't enroll to your fleet, try to ssh into the EC2 by running ssh -i ~/.ssh/<EC2 Key File> ubuntu@<EC2 IP Address> and then get the initialization logs by cat /var/log/cloud-init-output.log.
If ssh is not enabled, you can get the system logs from the EC2 instance
You might need to wait a bit until the logs become available but terminating the instance doesn't immediately delete them