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

[StorageBrowser] integrating existing S3 resources issue #6258

Open
calebpollman opened this issue Dec 18, 2024 · 0 comments
Open

[StorageBrowser] integrating existing S3 resources issue #6258

calebpollman opened this issue Dec 18, 2024 · 0 comments
Labels

Comments

@calebpollman
Copy link
Member

Hi, I'm having a bit of trouble to make it work with existing Cognito and S3 resources.
I've referenced the resources on backend configuration (code below), the bucket also has CORS configured according to the documentation: https://ui.docs.amplify.aws/react/connected-components/storage/storage-browser#bucket-cors

And I also set bucket policies to allow access from the Coginito Authenticated role to access and list the bucket.
However, I'm getting on display that there is "No folders or files"
I was able to make it work, if I edit amplify_outputs.json directly and add path configuration access to " * / * "

backend.addOutput({
  auth: {
    aws_region: BACKEND_CONFIG.REGION,
    user_pool_id: BACKEND_CONFIG.COGNITO_USER_POOL_ID,
    user_pool_client_id: BACKEND_CONFIG.COGNITO_USER_POOL_CLIENT_ID,
    identity_pool_id: BACKEND_CONFIG.COGNITO_IDENTITY_POOL_ID,
    username_attributes: ['username'],
    user_verification_types: ['email'],
    mfa_configuration: 'OPTIONAL',
    unauthenticated_identities_enabled: true,
    standard_required_attributes: ['email', 'name'],
    password_policy: {...}
  },
  storage: {
    aws_region: BACKEND_CONFIG.REGION,
    bucket_name: BACKEND_CONFIG.BUCKET
  }
});

Here is my bucket policy

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Effect": "Allow",
			"Principal": {
				"AWS": [
					"<ARN-COGNITO-ROLE-AUTHENTICATED>"
				]
			},
			"Action": [
				"s3:GetObject",
				"s3:PutObject",
				"s3:DeleteObject"
			],
			"Resource": "arn:aws:s3:::<BUCKET-NAME>/*"
		},
		{
			"Effect": "Allow",
			"Principal": {
				"AWS": [
					"<ARN-COGNITO-ROLE-AUTHENTICATED>"
				]
			},
			"Action": "s3:ListBucket",
			"Resource": "arn:aws:s3:::<BUCKET-NAME>/*"
		}
	]
}

Originally posted by @alanst32 in #5731 (comment)

@github-actions github-actions bot added the pending-triage Issue is pending triage label Dec 18, 2024
@cwomack cwomack added StorageBrowser feature-request Request a new feature and removed pending-triage Issue is pending triage labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants