If anyone is interested in taking a look, I would appreciate any feedback on the aws-elb charm I’ve been working on.
AWS-ELB layer: https://github.com/omnivector-solutions/layer-aws-elb
AWS-ELB interface: https://github.com/omnivector-solutions/interface-aws-elb
Built AWS-ELB charm: https://jujucharms.com/u/omnivector/aws-elb
Built flask-test-charm: https://jujucharms.com/u/jamesbeedy/flask-test/2
The general workflow is such that the aws-elb requires a relation to the aws-integrator charm, and also provides an interface for the aws-elb relation for a web application exposing the aws-elb endpoint to relate to.
The aws-integrator charm grants the aws-elb charm the capability to provision a loadbalancer and introspect instance, network, acm, and other resources in the aws cloud.
The aws-elb charm uses these policies granted by the aws-integrator to create the ELB infrastructure and attach related instances to the target groups created with the ELB.
Set the required config ‘cert-fqdn’ and ‘subnets’ (the charm will block until these two configs have been set).
Once the ELB has finished provisioning, get the fqdn and create a CNAME record in your DNS pointing at the fqdn returned for the ELB.
# Create the model and network space # (I often use a "nat" space that includes subnets that # use a routing table that points 0.0.0.0/0 -> nat-gw) juju add-model aws-elb-testing aws/us-west-2 juju add-spaces nat 172.31.102.0/24 172.31.103.0/24 172.31.104.0/24
# Deploy the aws-integrator, aws-elb, and flask-test charms juju deploy cs:~containers/aws-integrator-5 \ --constraints "spaces=nat instance-type=m5.large" juju deploy cs:~omnivector/aws-elb juju deploy cs:~jamesbeedy/flask-test-2 \ --constraints "spaces=nat instance-type=m5.large" juju expose flask-test # Trust, config, and make relations # (The aws-elb charm will block until the 'subnets' # and 'cert-fqdn' configs are set) juju trust aws-integrator # (use your own cert-fqdn and subnet ids - both must pre-exist in aws) juju config aws-elb cert-fqdn="*.peopledatalabs.com" juju config aws-elb subnets="subnet-1de11955,subnet-50b0f336,subnet-7128282a" juju relate aws-integrator aws-elb juju relate aws-elb flask-test
Following the above commands, your environment should settle once the ELB provisioning is complete (ensure to use your own cert-fqdn for a cert in ACM, and own subnet ids).
The juju status message for the aws-elb charm will display the progress of the ELB provisioning and health status example.
After the ELB is successfully created, you can use the action
get-elb-dns to get the dns name of the ELB.
$ juju run-action aws-elb/17 --wait get-elb-dns unit-aws-elb-17: id: 6e867463-2f3b-4411-82c9-6f14b6b8f209 results: elb-dns: juju-elb-a9dce8c-805899264.us-west-2.elb.amazonaws.com status: completed timing: completed: 2018-09-23 00:48:21 +0000 UTC enqueued: 2018-09-23 00:48:21 +0000 UTC started: 2018-09-23 00:48:21 +0000 UTC unit: aws-elb/17
Following this you need to create/update an CNAME record to point at the FQDN of the ELB before you will be able to successfully access the web endpoint.
To remove any AWS ELB resources created by this charm, just remove the aws-elb relation to the web application (using the example above
juju remove-relation aws-elb flask-test), and the aws-elb charm will clean up any resources it has created in the AWS cloud.
This will put the aws-elb charm back into a state where you could then re-relate another web application and have the aws-elb charm facilitate the whole setup process again.