Nomad AutoScaling with AWS target

I followed this guide on integrating AWS AutoScaling with Nomad:

It’s not very clear on where I should create this target block, so I wrote it on the agent configuration file, next to the “client” and “plugin” blocks.
When I try running the Nomad agent using this config I get an error:
“Error loading client.hcl: unexpected keys aws-asg, target”

This is how my target block looks like:
target “aws-asg” {
driver = “aws-asg”
config = {
aws_region = “eu-west-1”
aws_access_key_id = “xxxx”
aws_secret_access_key = “xxxx”

I tried looking on GitHub and over the internet for a way to solve it but from what I found, other people are using this target block the same way I do, so I can’t figure out what I’m doing wrong here.

I’m using Nomad 1.2.6.

Can someone please help me find out what I’m missing?

Hi @hilay.c

Thanks for using Nomad! I’m sorry the documentation isn’t as clear as it needs to be. Would you mind raising this as an issue in GitHub? It’s best if we can get these issues raised by community members directly.

In the meantime, here is a demo repo that you can reference that should help you figure out how and where to set configuration values. Hope that helps!

Thank you @DerekStrickland for the link!
From this template file I understand that the target is set as part of the job?

So no extra configurations should be defined on the agent’s side?
It sound a bit weird wince if two different jobs have the same auto scaling policy, wouldn’t it initiate two extra instances as part of the auto scaling (one for each job)?

I will create an issue in GitHub regarding the documentation.

Thank you

Hi @DerekStrickland , any more information you can provide to help me get into AutoScaling?

Hi @hilay.c

Sure. Here are some more resources.

  • First, start with the official docs
  • Second, if it’s not clear, the nomad-autoscaler is a separate daemon from the Nomad client. It requires its own configuration.
  • The demo repo includes a job to run the daemon in a docker container within the nomad cluster.
  • Notice, that the job has a template stanza that writes the config needed for the autoscaler into a file within the container.
  • That rendered template contains the necessary target block. That’s where the target gets set. Not at the client level.

In researching this for you, I realize one of the big fixes we need to make in the documentation is to point out very clearly that the Auto-Scaler is a separate daemon. The GitHub README points this out in the first line, but the docs do not. That had to be confusing for you and I’m very sorry about that. I’ll take a pass at improving that here shortly.

Did this help?