Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I setting s3 buckets policy locally? #22

Open
daikiterai opened this issue Apr 27, 2016 · 3 comments
Open

Can I setting s3 buckets policy locally? #22

daikiterai opened this issue Apr 27, 2016 · 3 comments

Comments

@daikiterai
Copy link

Dear serverless-team.

S3 buckets policy setting is fixed in index.js.
Therefore,we always change to s3 buckets policy at deploy time.
We would like to setting to s3 buckets policy in local serverless project.
Do you have any ideas?

let policy = {
Version: "2008-10-17",
Id: "Policy1392681112290",
Statement: [
{
Sid: "Stmt1392681101677",
Effect: "Allow",
Principal: {
AWS: "_"
},
Action: "s3:GetObject",
Resource: "arn:aws:s3:::" + this.bucketName + '/'
}
]
};

Thanks.

@eahefnawy
Copy link
Contributor

oh do you mean if you add to the bucket policy after first deployment and try to deploy again, it'll overwrite your changes?

hmmm interesting! yeah I think you're right. It should be in a policy.json file that you can add to.

@daikiterai
Copy link
Author

Thank you for your answer.
Yes,I separete two policy in same backet, one is for management, another is for global.
like below

{ "Version": "2008-10-17", "Id": "Policy1392681112290", "Statement": [ { "Sid": "IPAllow", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "arn:aws:s3:::(bucketName)/manager/*", "Condition": { "IpAddress": { "aws:SourceIp": [ "(secure IP address)" ] } } }, { "Sid": "IPAllow", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "arn:aws:s3:::(bucketName)/public/*" } ] }

"sls client deploy" command is restore bucket policy to default.
I hope setting policy in local project with config file(ex: policy.json or s-project.json) .
It's also available for CI.

Thanks.

@str3tch
Copy link

str3tch commented Aug 29, 2016

we put in a PR for this.. waiting for it to get merged: #31

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

No branches or pull requests

3 participants