Cognito Federated to Salesforce and S3 Presigned URL

1 min read cognito, salesforce, s3

Written in 2019. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/cognito-federated-to-salesforce-and-s3-presigned-url-playground.

Login with Cognito Federated to Salesforce Example

# local dev
# start server.  serves static files from current directory '.'.  listens on ssl 443
sudo node server.js
open https://localhost

# on s3
open https://amzn-s3-demo-static-site.s3.amazonaws.com/index.html

# on cloudfront
open https://d3tz189emgpc7c.cloudfront.net/index.html

# copy updated file to s3
aws s3 cp index.html s3://amzn-s3-demo-static-site/index.html
# invalidate cloudfront dist after copy

# if any login issues
# clear site data for https://pfeil-dev-ed.my.salesforce.com in chrome dev tools

Pre-signed URL Example

  • see index.js
  • node index.js outputs pre-signed url. (uses ~/.aws/credentials and pre-signed URL generated under that users context/permission)
  • PUT / upload file to S3 via curl -X PUT -T hello.txt -L '<pre-signed url>'

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.