AWS IAM Users, Roles, Groups and Policies
In this guide, we'll be using the AWS IAM connector (autoschematic-connector-aws-iam
).
As opposed to the last guide, where we imported existing infrastructure and modified it, here we'll be creating new IAM resources from scratch.
There's a demo repo for this example, too - all it contains is autoschematic.ron, so skip it if you feel you can handle setting it up yourself.
Scaffolding resources with autoschematic create
To help users quickly draft and create new resources, the Autoschematic protocol allows each connector to supply skeleton resources of various types. You can see what skeletons are available by using autoschematic create
to select your prefix and connector interactively, and fill in the address template like so:
Now, we'll modify our policy to grant access to a certain S3 bucket, and we'll attach that policy by its ARN output value to the IAM role:
main/aws/iam/policies/minecraft-support-access.ron
main/aws/iam/roles/minecraft-server-support.ron
See the "out://" syntax in the IAM role? That's a reference to an output provided by another file. Since the IAM policy doesn't exist yet, Autoschematic will have to handle creating the IAM policy first before the IAM role.
Let's git add
what we have so far, and apply it!
Nice. So, this is a sort of multi-stage plan-apply flow. Autoschematic is designed to be very explicit at all stages in terms of what actions it will take. Terraform, on the other hand, can be a little less deterministic.
If you're wondering whether there are other AWS connectors available, there are! They're in varying stages of stability, but you can have similar fun with Route53, S3, VPCs, and more.