Skip to content

Instantly share code, notes, and snippets.

@kapadia
Created July 15, 2016 18:18
Show Gist options
  • Select an option

  • Save kapadia/10bd10511292a7ec5f0543c579921252 to your computer and use it in GitHub Desktop.

Select an option

Save kapadia/10bd10511292a7ec5f0543c579921252 to your computer and use it in GitHub Desktop.
landsat-pds bucket policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::000000000000:root"
},
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::landsat-pds"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::000000000000:root"
},
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::landsat-pds/*"
}
]
}
@jedsundwall

Copy link
Copy Markdown

This needs the statement to allow anyone to list and get things from the bucket too. How about this?

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "landsat-pds",
      "Effect": "Allow",
      "Principal": "*",
      "Action": [
        "s3:GetBucketLocation",
        "s3:Get*",
        "s3:List*"
      ],
      "Resource": [
        "arn:aws:s3:::landsat-pds",
        "arn:aws:s3:::landsat-pds/*"
      ]
    },
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::000000000000:root"
      },
      "Action": [
        "s3:ListBucket",
        "s3:GetBucketLocation"
      ],
      "Resource": "arn:aws:s3:::landsat-pds"
    },
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::000000000000:root"
      },
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::landsat-pds/*"
    }
  ]
}

Because the first statement allows anyone to list everything and get the bucket location, the second statement might be redundant.

@jflasher

Copy link
Copy Markdown

Yeah, I think @jedsundwall 's should work, and you can probably get rid of the last GetObject as well then.

@kapadia

kapadia commented Jul 15, 2016

Copy link
Copy Markdown
Author

Thanks for the feedback. I was wondering if this removed the public access, thanks for the additional statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment