https://pulumi.com logo
b

busy-kitchen-1186

09/05/2023, 6:08 PM
Anybody knows some examples of creating a docker swarm cluster on aws?
s

salmon-account-74572

09/05/2023, 7:13 PM
If you can find an AMI that has a sufficiently recent enough version of Docker pre-installed, then you could instantiate some number of EC2 instances using that AMI and then use the
Command
module to run the Docker commands necessary to establish a Swarm cluster.
b

busy-kitchen-1186

09/05/2023, 7:19 PM
how do i get return from
docker swarm init
, which is needed for the worker nodes?
s

salmon-account-74572

09/05/2023, 7:25 PM
If you’re using
command.remote.Command
(see https://www.pulumi.com/registry/packages/command/api-docs/remote/command/) there are
stdout
and
stderr
outputs that should capture the return of the
docker swarm init
command. You’ll have to parse it down to what you need, and then pass that information on to create the worker nodes.
BTW, the reason I suggested the
Command
module is because the current Docker provider does not have any functionality for establishing a Swarm cluster.
b

busy-kitchen-1186

09/06/2023, 8:17 PM
got you, thanks
I checked the command module, it needs direct ssh access. Usually I setup worker er2 instances to have only private ip addresses. Any suggestion? @salmon-account-74572
s

salmon-account-74572

09/12/2023, 6:36 PM
Use an SSH bastion?
b

busy-kitchen-1186

09/12/2023, 7:38 PM
I don't see how to set up bastion host in command module.
the manager node has public ip, can be the jump host, in my setup
s

salmon-account-74572

09/12/2023, 8:01 PM
Sorry---bastion host (or jump host) isn’t part of the Command module, Using a node with a public IP, as you’ve suggested, is what I meant. Apologies that I wasn’t more clear.
b

busy-kitchen-1186

09/13/2023, 5:16 AM
trying to work around this issue now
thanks