sparse-intern-71089
06/10/2023, 12:40 AMsteep-toddler-94095
06/10/2023, 2:56 AMs3:*
permissions for arn:aws:s3:::${bucketName}
, and if the bucket policy does not deny permissions, then the user should have permissions to modify the bucket policythousands-tomato-60851
06/10/2023, 3:04 AMpulumi up
again?
Type Name Status Info
+ pulumi:pulumi:Stack play-dev **creating failed (4s)** 1 error
+ ├─ aws:s3:Bucket my-bucket created (2s)
+ ├─ aws:s3:BucketPolicy my-bucket-policy **creating failed** 1 error
+ ├─ aws:s3:BucketNotification my-bucket-notification created (0.90s)
+ ├─ aws:s3:BucketObject my-bucket-object created (0.95s)
+ └─ aws:s3:BucketMetric my-bucket-metric created (1s)
Diagnostics:
aws:s3:BucketPolicy (my-bucket-policy):
error: 1 error occurred:
* Error putting S3 policy: AccessDenied: Access Denied
status code: 403, request id: R1MFA79VA0K1HSVA, host id: Kt6WTL3laYuyCsixxqXOskKzXMWfVDVP0Xj6SfgXVLkbggf8OmAz0+zdn/qqSVinietBTce1O74=
pulumi:pulumi:Stack (play-dev):
error: update failed
steep-toddler-94095
06/10/2023, 3:12 AMsteep-toddler-94095
06/10/2023, 3:19 AMthousands-tomato-60851
06/10/2023, 3:22 AMthousands-tomato-60851
06/10/2023, 3:23 AMimport * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
const bucket = new aws.s3.Bucket("my-bucket", {
bucket: "my-bucket-reapi-test",
});
const exampleBucketPublicAccessBlock = new aws.s3.BucketPublicAccessBlock(
"exampleBucketPublicAccessBlock",
{
bucket: bucket.id,
blockPublicAcls: true,
blockPublicPolicy: false,
ignorePublicAcls: true,
restrictPublicBuckets: true,
}
);
const bucketMetric = new aws.s3.BucketMetric("my-bucket-metric", {
bucket: bucket.bucket,
});
const bucketNotification = new aws.s3.BucketNotification(
"my-bucket-notification",
{
bucket: bucket.bucket,
}
);
const bucketObject = new aws.s3.BucketObject("my-bucket-object", {
bucket: bucket.bucket,
content: "hello world",
});
const bucketPolicy = new aws.s3.BucketPolicy("my-bucket-policy", {
bucket: bucket.bucket,
policy: bucket.bucket.apply(publicReadPolicyForBucket),
});
function publicReadPolicyForBucket(bucketName: string) {
return JSON.stringify({
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: "*",
Action: ["s3:GetObject"],
Resource: [
`arn:aws:s3:::${bucketName}/*`, // policy refers to bucket name explicitly
],
},
],
});
}
// Export the name of the bucket
export const bucketName = bucket.id;
steep-toddler-94095
06/10/2023, 3:53 AMthousands-tomato-60851
06/10/2023, 5:05 AMsalmon-account-74572
06/12/2023, 12:09 PM