In My Project, I have S3 bucket but i have to recursively acccess all the objects within that given bucket. It should be like recursively processing directory or file structure. When i tried to access the objects of the bucket, I'm getting AccessDeniedException.
s3 = AWS::S3.new
bucket = s3.buckets['bucket_name']
bucket.objects #raises Exception
I'm not sure if this is the correct way to do this, but I had a problem where I was not able to upload to anything other than the root folders with the other IAM accounts I created. After adding this change in the image below I was able to put objects in folders other than the root path.
In my case I had created the bucket with the root account, but had another user that was setup to add files to the bucket. The other user account was the one that had issues adding new items into the bucket.
Related
I have a firebase project and I added a Firestore database but I forgot to choose the right location. Since the location can not be modified after creating the database and the database is empty I would like to just delete it and create a new one with the correct location. Is this possible or do I need to create the whole project again?
Would appreciate help a lot.
Once a region is set for a project, it can't be changed. In the documentation it says:
Warning: Setting the location for one of the following services [Firestore, Storage, App Engine] also sets the location for the others. After you set your project's default GCP resource location, you cannot change it.
So, you will have to create a whole new project.
We can move a file to S3 like so
library(aws.s3)
saveRDS(iris, "iris.RDS")
put_object("iris.RDS", object="iris.RDS", bucket="mybucket", acl=c("public-read"))
Instead of moving the file to the root of the S3 bucket, how can I place it inside a folder in the S3 bucket?
What I've tried
I've tried the obvious solution, prepending the folder name to the object, but it errors
put_object("iris.RDS", object="myfolder/iris.RDS", bucket="mybucket", acl=c("public-read"))
Notes
I have already created a folder manually through the browser, so it's ready to go, I just need to know how to put files there
I want to model data in firestore to get items in directories shared by several users (folders are secured with security rules).
My current model is as follows:
/folders/{folder}/folders/{subfolder}
/folders/{folder}/items/{item}
/folders/{folder}/folders/{subfolder}/items/{item}
A user can access several folders and if he accesses the root folder he can also access the subfolders. He can also access subfolders (if he has permission) and his access to the root folder is restricted.
The idea is that the system can list all the items that the user can access.
Is there a way without having to make a query for each folder?
If I make a query for each folder I would have a query for each root and for each subfolder. It would be many queries
Duplicating the access roles of the folders in the items could be an option but with a big problem when the permissions are modified
The directory can only have up to two depth levels (root and
subfolders).
You could have a document per user where you can write every folder id the user can access. Then you could query only these folders.
And if you have a lot of events the users can access i would recommend to show a folder structure to the user like in a file system. So you could save a lot of unnecessary reads for documents the user does not need.
I have deploy wordpress multiple site on google app engine and now i want to change uploads folder as google bucket folder where i can upload media. Now the following issue i have ..
Unable to create directory https://console.cloud.google.com/storage/browser/media-wordpress/. Is its parent directory writable by the server?
OR
Unable to create directory gs://media-wordpress/. Is its parent directory writable by the server?
So how I can make writable for my wordpress site or ananamous users.
Sam
You'll need to create the bucket media-wordpress from your Developer Console or the gsutil tool for example as explained here. Once done, you'll be able to reference this bucket in Wordpress with the format https://storage.googleapis.com/media-wordpress/
I had the same issue. Exactly:
Unable to create directory 1. Is its parent directory writable by the server?
on image upload. After two days of debugging I dumped exception:
Cannot use ACL API to set object policy when object policies are disabled
found this advice and changed my bucket policy to "individual object permissions" aka "object-level permissions" on Permissions tab.
Assume I want to write to a new file created within the space of my webapp.
One way would be use getServletContext().getRealPath("/") and use that String to create a new file on the server. However, often I come across advice like not using getServletContext().getRealPath("/").
Can someone please let me know of another way to write a new file within my webapp?
Many thanks.
Have some configuration property containing the absolute path of a directory outside of the webapp and web server path, read this path from the configuration property, and write to this directory.
To serve files from this directory, write a servlet that takes the name or ID of this file as parameter, reads the file from the directory, and sends its content to the response.
This will
work even if the app is deployed as a war file and never unzipped to the file system
allow you to redeploy the next version of the app or server without deleting all the uploaded/created files
allow you to add whatever control you want on the uploaded/created files, instead of making them available to everyone
In short, treat these files as data, stored in a database which happens to be the file system instead of a SQL database.