How do I determine if an S3 bucket has public access using aws-cli












1















I have a bucket that shows "public access" in the console, but when I attempt to read the aws s3api get-public-access-block, I get an error:



$ aws s3api get-public-access-block --bucket my-test-bucket-name
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:

abort-multipart-upload | complete-multipart-upload
copy-object | create-bucket...


I am running aws-cli 1.15.83:



$ aws --version
aws-cli/1.15.83 Python/2.7.14 Linux/4.14.77-70.59.amzn1.x86_64 botocore/1.10.82









share|improve this question



























    1















    I have a bucket that shows "public access" in the console, but when I attempt to read the aws s3api get-public-access-block, I get an error:



    $ aws s3api get-public-access-block --bucket my-test-bucket-name
    usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
    To see help text, you can run:

    aws help
    aws <command> help
    aws <command> <subcommand> help
    aws: error: argument operation: Invalid choice, valid choices are:

    abort-multipart-upload | complete-multipart-upload
    copy-object | create-bucket...


    I am running aws-cli 1.15.83:



    $ aws --version
    aws-cli/1.15.83 Python/2.7.14 Linux/4.14.77-70.59.amzn1.x86_64 botocore/1.10.82









    share|improve this question

























      1












      1








      1








      I have a bucket that shows "public access" in the console, but when I attempt to read the aws s3api get-public-access-block, I get an error:



      $ aws s3api get-public-access-block --bucket my-test-bucket-name
      usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
      To see help text, you can run:

      aws help
      aws <command> help
      aws <command> <subcommand> help
      aws: error: argument operation: Invalid choice, valid choices are:

      abort-multipart-upload | complete-multipart-upload
      copy-object | create-bucket...


      I am running aws-cli 1.15.83:



      $ aws --version
      aws-cli/1.15.83 Python/2.7.14 Linux/4.14.77-70.59.amzn1.x86_64 botocore/1.10.82









      share|improve this question














      I have a bucket that shows "public access" in the console, but when I attempt to read the aws s3api get-public-access-block, I get an error:



      $ aws s3api get-public-access-block --bucket my-test-bucket-name
      usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
      To see help text, you can run:

      aws help
      aws <command> help
      aws <command> <subcommand> help
      aws: error: argument operation: Invalid choice, valid choices are:

      abort-multipart-upload | complete-multipart-upload
      copy-object | create-bucket...


      I am running aws-cli 1.15.83:



      $ aws --version
      aws-cli/1.15.83 Python/2.7.14 Linux/4.14.77-70.59.amzn1.x86_64 botocore/1.10.82






      amazon-s3 aws-cli






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 '18 at 22:39









      AG6HQAG6HQ

      476




      476
























          2 Answers
          2






          active

          oldest

          votes


















          1














          You can use aws s3api get-bucket-policy-status to find out which buckets have been identified as having public access:



          aws s3api get-bucket-policy-status --bucket my-test-bucket-name
          {
          "PolicyStatus": {
          "IsPublic": true
          }
          }


          The get-public-access-block function is related to new features released last week [1], that help to protect future buckets from being mistakenly created with public access.



          Both get-public-access-block and get-bucket-policy-status require a newer version of awscli than 1.15.83. The version I am using that has both these commands is 1.16.58.



          [1] https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/






          share|improve this answer































            0














            The error you might be getting because of you might not have upgraded awscli.



            You pip command to upgrade.



            pip install --upgrade awscli


            The same error was getting at the start. It should upgrade and give the proper result.






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383674%2fhow-do-i-determine-if-an-s3-bucket-has-public-access-using-aws-cli%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              You can use aws s3api get-bucket-policy-status to find out which buckets have been identified as having public access:



              aws s3api get-bucket-policy-status --bucket my-test-bucket-name
              {
              "PolicyStatus": {
              "IsPublic": true
              }
              }


              The get-public-access-block function is related to new features released last week [1], that help to protect future buckets from being mistakenly created with public access.



              Both get-public-access-block and get-bucket-policy-status require a newer version of awscli than 1.15.83. The version I am using that has both these commands is 1.16.58.



              [1] https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/






              share|improve this answer




























                1














                You can use aws s3api get-bucket-policy-status to find out which buckets have been identified as having public access:



                aws s3api get-bucket-policy-status --bucket my-test-bucket-name
                {
                "PolicyStatus": {
                "IsPublic": true
                }
                }


                The get-public-access-block function is related to new features released last week [1], that help to protect future buckets from being mistakenly created with public access.



                Both get-public-access-block and get-bucket-policy-status require a newer version of awscli than 1.15.83. The version I am using that has both these commands is 1.16.58.



                [1] https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/






                share|improve this answer


























                  1












                  1








                  1







                  You can use aws s3api get-bucket-policy-status to find out which buckets have been identified as having public access:



                  aws s3api get-bucket-policy-status --bucket my-test-bucket-name
                  {
                  "PolicyStatus": {
                  "IsPublic": true
                  }
                  }


                  The get-public-access-block function is related to new features released last week [1], that help to protect future buckets from being mistakenly created with public access.



                  Both get-public-access-block and get-bucket-policy-status require a newer version of awscli than 1.15.83. The version I am using that has both these commands is 1.16.58.



                  [1] https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/






                  share|improve this answer













                  You can use aws s3api get-bucket-policy-status to find out which buckets have been identified as having public access:



                  aws s3api get-bucket-policy-status --bucket my-test-bucket-name
                  {
                  "PolicyStatus": {
                  "IsPublic": true
                  }
                  }


                  The get-public-access-block function is related to new features released last week [1], that help to protect future buckets from being mistakenly created with public access.



                  Both get-public-access-block and get-bucket-policy-status require a newer version of awscli than 1.15.83. The version I am using that has both these commands is 1.16.58.



                  [1] https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 '18 at 3:45









                  mvermaesmvermaes

                  30636




                  30636

























                      0














                      The error you might be getting because of you might not have upgraded awscli.



                      You pip command to upgrade.



                      pip install --upgrade awscli


                      The same error was getting at the start. It should upgrade and give the proper result.






                      share|improve this answer






























                        0














                        The error you might be getting because of you might not have upgraded awscli.



                        You pip command to upgrade.



                        pip install --upgrade awscli


                        The same error was getting at the start. It should upgrade and give the proper result.






                        share|improve this answer




























                          0












                          0








                          0







                          The error you might be getting because of you might not have upgraded awscli.



                          You pip command to upgrade.



                          pip install --upgrade awscli


                          The same error was getting at the start. It should upgrade and give the proper result.






                          share|improve this answer















                          The error you might be getting because of you might not have upgraded awscli.



                          You pip command to upgrade.



                          pip install --upgrade awscli


                          The same error was getting at the start. It should upgrade and give the proper result.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 20 '18 at 8:44









                          Pang

                          6,8921563101




                          6,8921563101










                          answered Nov 20 '18 at 7:31









                          Pradeep R BPradeep R B

                          13




                          13






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383674%2fhow-do-i-determine-if-an-s3-bucket-has-public-access-using-aws-cli%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              MongoDB - Not Authorized To Execute Command

                              How to fix TextFormField cause rebuild widget in Flutter

                              Npm cannot find a required file even through it is in the searched directory