Force SSL on Amazon S3

后端 未结 2 1033
广开言路
广开言路 2020-12-30 19:58

Is it possible (via IAM, bucket policy, or otherwise) to force Amazon S3 to only serve content over HTTPS/SSL and deny all regular, unencrypted HTTP access?

2条回答
  •  悲哀的现实
    2020-12-30 20:49

    Here you allow your incoming traffic but refuse the non SSL one. If you want to go back just remove the 2nd statement:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Allow",
                "Principal": {
                    "AWS": "*"
                },
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::yourbucketnamehere/*"
            },
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Deny",
                "Principal": {
                    "AWS": "*"
                },
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::yourbucketnamehere/*",
                "Condition":{
                    "Bool":
                    { "aws:SecureTransport": false }
                }
            }
        ]
    }
    

    Don't forget to put your bucket name at yourbucketnamehere.

    Now you need to install a SSL certificate. All the information can be found here.

提交回复
热议问题