Pricing question - is each S3 bucket object billed...
# getting-started
Pricing question - is each S3 bucket object billed as a separate resource....? or is the S3 bucket itself billed as a single resource? The dashboard shows that we'll be getting billed for 500+ resources in a development stack with a single S3 bucket and not much else in it. I want to confirm that is correct.
If you manage the bucket objects with Pulumi (e.g., with
), they yes, they are counted. But if you only manage the bucket itself, then it'd just be the one resource. In cases where you don't need Pulumi to manage these resources (e.g., if you're managing a static website with hundreds or thousands of files), we have a component you can use to sync them to a bucket so you don't have to deal with having to write that machinery yourself:
In most cases this is what I use, and our static-website templates use it also:
That makes a lot of sense; I was using this guide -> Which led to the situation in question. I'll use the ones you linked instead, thank you!
You bet, best of luck!
interesting! this object implementation: in this template (static-website-aws-typescript): is producing one object per file. I checked for weird exceptions or deviations from template and nada - do you have any advice?
Did you set
? (The default implementation also uses
no I did not! it wasnt in the template, let me try it
You may need to
again, as the component doens't handle switching seamlessly between these. (There's a note about this at the end of that section.)
Also, check out the aws-static-website provider, which does all this too. Maybe its implementation will give you some ideas (or maybe it's the tool you need!)
worked out perfectly 😄 thank you cnunciato and tenwit!!
last question, given the following index.ts code:
Copy code
const bucketFolder = new synced_folder.S3BucketFolder("bucket-folder", {
    path: path,
    bucketName: bucket.bucket,
    acl: "public-read",
    managedObjects: false
}, { dependsOn: [ownershipControls, publicAccessBlock]});
and the following stack:
Copy code
├─ synced-folder:index:S3BucketFolder                      bucket-folder
    │  └─ command:local:Command                                bucket-folder-sync-command
How does one actually invoke the command - programmatically or via CLI? having some issues trying to divine that from
Commands are run whenever they are created, updated or deleted. Changes to
also triggers execution:
So you can, for example, have a rerun property on a ComponentResource that wraps your local.Command, and any time you change it (e.g. it could be a number and you incrememt it), that'll force a run. More often, you might use the id or arn property of a resource: any time that changes (because it's created or replaced) then the Command would run (to initialize the new resource).
These are correct, but the idea with this particular component (synced-folder) is that you shouldn't need to "do" anything beyond, say, changing the contents of one of the files that belong to whatever folder you're syncing to S3, and then run `pulumi up`; the
aws s3 sync
command is invoked implicitly (and only when necessary) by the synced-folder component.