1 hour ago · Tech · hide · 0 comments

I'm currently in the process of moving my site's media (under media.jvt.me) from Netlify to AWS S3. The underlying infrastructure for my site that writes this media is hosted on Fly.io, so needs a way to write to S3. I really wanted to avoid long-lived AWS credentials, and fortunately Fly supports OpenID Connect which integrates with AWS' OpenID Connect Federation to allow you to use short-lived OpenID Connect tokens to authenticate as a given IAM role, and then perform any necessary AWS actions. Although Fly has an example with curl, I wanted to blogument the "how to" with Go, as it wasn't super straightforward to do so. I've written this up in a sample repo on GitLab.com. Go code The core pieces are: // via https://gist.github.com/teknoraver/5ffacb8757330715bcbcc90e6d46ac74 var unixClient = http.Client{ Transport: &http.Transport{ DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { return net.Dial("unix", "/.fly/api") }, }, } func getOIDCToken(unixClient…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.