How to create and use spaces on AWS

Great post, and I am attempting to replicate this myself now…

So far I have

1.) a VPC id running 2.) a subnet for public with an NAT Gateway 3.) An Internet Gateway 4.) a subnet that’s isolated but in same VPC as the other 5.) juju can successfully show my subnets and I have named two spaces there… as well as gotten a model wired into the VPC-ID

but when I goto deploy I have an error

$ juju spaces
Name                Space ID  Subnets     
alpha               0                     
my-first-space  1         10.0.2.0/24 
                              252.2.0.0/16
my-first-space-public   2         10.0.1.0/24 
                              252.1.0.0/16

juju deploy ubuntu --constraints spaces=my-first-space-public

Now if I do deploy another way… it seems to get further but then I never get past pending status

 juju deploy ubuntu --bind my-first-space

My status with each machine shows the following

juju status                                             
Model                Controller  Cloud/Region   Version  SLA          Timestamp
my-first-model  cntrl        aws/us-best-1  2.8.7    unsupported  13:17:15+02:00

App     Version  Status   Scale  Charm   Store       Channel  Rev  OS      Message
ubuntu           waiting    0/1  ubuntu  charmstore            18  ubuntu  waiting for machine

Unit      Workload  Agent       Machine  Public address  Ports  Message
ubuntu/4  waiting   allocating  4                               waiting for machine

Machine  State    DNS            Inst id              Series  AZ          Message
3        pending  3.1.12.3  i-some_id_num  bionic  us-west-1b  running
4        down                    pending              bionic              matching subnets to zones: cannot use space "alpha" as deployment target: no subnets

I thought maybe I had to constrain the deployment to the same AZ as the subnet… so I did that at the model level but still nothing changed and juju’s deployed ubuntu never really becomes available

EDIT:

The good news is… I got juju ubuntu charm started status on the public subnet… now retrying on the private one… but having a tricky time adding a unit with the space constraint… or how to deploy two instances of the ubuntu application in the same model

EDIT2:

okay wow… after some finagling and gnashing of teeth… I got a charm deployed in each space… though with a command different from the poster

juju deploy mongodb --bind <the_space_you_want>