aws s3设置跨域,s3配置预签名,aws 配置文件上传
1. 创建桶,然后点击桶名称
2. 点击权限
3. 存储桶策略配置:
lucky-lbc-001 改为你自己的桶名称
注: 我的策略有的都是* , 生产一定要自己再调下相关策略,比如action不能为*,把删除得去掉。
{"Version": "2012-10-17","Statement": [{"Sid": "Deny a presigned URL request if the signature is more than 10 min old","Effect": "Deny","Principal": {"AWS": "*"},"Action": "s3:*","Resource": "arn:aws:s3:::lucky-lbc-001/*","Condition": {"NumericGreaterThan": {"s3:signatureAge": "600000"}}}]
}
4. 对象所有权,添加为acl控制。 点击编辑
5. 配置跨域, 可以本地测试使用
[{"AllowedHeaders": ["*"],"AllowedMethods": ["PUT","POST","DELETE"],"AllowedOrigins": ["*"],"ExposeHeaders": []}
]
注:
aws 得客服还需要收费,本文绝对为你省去了点服务费~~
参考文档:
https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/userguide/using-presigned-url.html
https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/userguide/UsingBucket.html