Using different worker pools per environment

(jason_finlayson) #1

Just getting around to testing / migrating to worker pools. I am wondering if there is a way to have the same step run on different worker pools depending on which environment I am deploying to. So for example, we have 2 separate AWS accounts for Prod vs. Non-Prod. We have a step that runs a CloudFormation template and we are using IAM roles to give the workers permission to deploy the template. So when we are deploying to the Prod account we need to use the Prod worker, Non-Prod uses Non-Prod worker, etc.

(Kenneth Bates) #3

Hi Jason,

Thanks for getting in touch! This is a great question, and while it’s not currently possible to directly scope a worker pool to an environment, there is a way to work around this to reach the same behavior by taking advantage of the magic of cloud regions.

What you’ll need are cloud regions to map to environments, and scope your step to run on this cloud region to execute the work. I’ve set up an example below to help visualize how this works.

The configuration of my cloud region:

My step is scoped to that role:

When deploying to Development, the resulting log reports Leased worker Dev Worker from pool Dev Region (lease WorkerTaskLeases-3), and promoting to Testing reports Leased worker Test Worker from pool Test Region (lease WorkerTaskLeases-4).

I hope this helps for the time being! Scoping worker pools to environments is something we totally agree should be possible, and it’s something we’re currently in the process of implementing. This will make it much easier in the future. :slight_smile:

Let me know if there’s anything else I can assist with in any way.

Best regards,

Kenny

(jason_finlayson) #4

Thanks for that. This will work for the moment. I do look forward to the ability to scope to the environment process.