https://pulumi.com logo
#general
Title
# general
m

magnificent-lifeguard-15082

03/04/2022, 5:41 PM
How are people uploading static sites [to s3 but pretty general problem] via pulumi which don't end up costing.. thousands of credits because the documented examples all use a BucketObject resource per file? I'm hoping someone has shared some component resource which does an s3 sync under the hood.
q

quick-airport-30353

03/04/2022, 6:29 PM
have you considered using Docker?
b

billowy-army-68599

03/04/2022, 6:55 PM
I can't find it now, unfortunately, but a community user wrote a dynamic provider that would "throw files in s3" and was a single resource, I'll try track it down
m

millions-furniture-75402

03/04/2022, 8:33 PM
Similarly to the script idea mentioned, we leverage the
aws
cli, because the
sync
command is great:
Copy code
aws s3 sync ./static-site s3://$(pulumi stack output contentFilesBucketId) --delete
m

melodic-butcher-88362

03/04/2022, 8:42 PM
You could also try leveraging the command provider, so you can use
aws s3 sync
as one resource within pulumi
g

great-queen-39697

03/04/2022, 8:58 PM
Ah, @billowy-army-68599, I think I found the one you're talking about: https://www.npmjs.com/package/@wanews/pulumi-throw-files-in-s3
That being said, I also mentioned in the #aws thread that I've heard of (but haven't seen code for) a solution that uploads a file archive and uses Glue to unzip it.
b

billowy-army-68599

03/04/2022, 9:00 PM
that's the one! great find!
🎉 1
m

magnificent-lifeguard-15082

03/06/2022, 11:59 AM
Great, thanks all 🙂
Is there a convenient way I can expose my current pulumi session credentials to a pulumi.Command somewhat idiomatically?
Ie. I use
assumeRole
in aws provider config and so the cli usage of aws s3 sync would need to assume that role to
would be nice to re-use the pulumi session than create another one
ah guess I can use
environment
arg
g

great-queen-39697

03/07/2022, 10:50 PM
That would be the route I would go for now. The Command provider is still in preview and may be missing some functionality that would make sense for general use; if you think it's a good feature, it would be great if you'd add an issue on the repo! https://github.com/pulumi/pulumi-command/issues
12 Views