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

bug: cdklocal call to S3 put_public_access_block fails with 'Access Denied' #10724

Open
1 task done
jrobbins-LiveData opened this issue Apr 25, 2024 · 3 comments
Open
1 task done
Labels
area: integration/cdk Issues related to AWS Cloud Development Kit aws:s3 Amazon Simple Storage Service status: backlog Triaged but not yet being worked on type: bug Bug report

Comments

@jrobbins-LiveData
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The following Python code running in a cdk stack

    s3_client.put_public_access_block(
        Bucket=bucket_name,
        PublicAccessBlockConfiguration=dict(
            BlockPublicAcls=True,
            IgnorePublicAcls=True,
            BlockPublicPolicy=True,
            RestrictPublicBuckets=True
        ),
        ExpectedBucketOwner=stack.ensure_context('account')
    )

fails during cdklocal bootstrap with this traceback

  File [REDACTED] in copy_to_s3
    s3_client.put_public_access_block(
  File ".venv\Lib\site-packages\botocore\client.py", line 565, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv\Lib\site-packages\botocore\client.py", line 1021, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutPublicAccessBlock operation: Access Denied

Subprocess exited with error 1

### Expected Behavior

I expected the call to set the indicated PublicAccessBlockConfiguration on the bucket.

### How are you starting LocalStack?

Custom (please describe below)

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    using the docker desktop extension

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    cdklocal bootstrap


### Environment

```markdown
- OS: Windows 10 
- LocalStack: 3.4.0

Anything else?

Other S3 boto3 calls work, so I am assuming that this is a particular problem with the put_public_access_block call implementation?

@jrobbins-LiveData jrobbins-LiveData added status: triage needed Requires evaluation by maintainers type: bug Bug report labels Apr 25, 2024
@localstack-bot
Copy link
Collaborator

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

@bentsku bentsku added status: response required Waiting for a response from the reporter area: integration/cdk Issues related to AWS Cloud Development Kit aws:s3 Amazon Simple Storage Service and removed status: triage needed Requires evaluation by maintainers labels Apr 25, 2024
@bentsku
Copy link
Contributor

bentsku commented Apr 25, 2024

Hello @jrobbins-LiveData and thanks for your report!

Could you share LocalStack logs when this happens? You can enable more verbose logs with LS_LOG=trace and look for PutPublicAccessBlock, we should get more information about that request.

Looking at our implementation, I'm not seeing anything that would raise AccessDenied. Do you start LocalStack with any specific configuration? Thanks!

@localstack-bot localstack-bot removed the status: response required Waiting for a response from the reporter label Apr 25, 2024
@jrobbins-LiveData
Copy link
Author

I'm running LocalStack via the Docker Desktop extension. This is my Configuration -- is the LS_LOG setting correct?
image

I am running cdklocal bootstrap. Do I have to configure anything special to "point it" at my localstack?

The run fails consistently with the "Access Denied" error. Here's the log:

localstack_log.txt

@MarcelStranak MarcelStranak added the status: backlog Triaged but not yet being worked on label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: integration/cdk Issues related to AWS Cloud Development Kit aws:s3 Amazon Simple Storage Service status: backlog Triaged but not yet being worked on type: bug Bug report
Projects
None yet
Development

No branches or pull requests

4 participants