Expand my Community achievements bar.

S3 Blob storage Hashing

Avatar

Level 2

I am trying to figure out how to map a  S3 bucket file to an asset.

If I have a file on my PC which I know exists in AEM with S3 Segmented Storage how can i find the file directly in S3?

I tried this without any success:

$ shasum -a256 ~/Downloads/asdf.jpg

08550272769f2ded3cd8f3da8d98cad0a5eb8316fa5662b763dca8c71ca055f8  ~/Downloads/asdf.jpg

$ aws s3 ls s3://bucketname/08550272769f2ded3cd8f3da8d98cad0a5eb8316fa5662b763dca8c71ca055f8

In case its different I am trying to do this in both AEM 6.2 and 6.5.

Thanks in advance

2 Replies

Avatar

Level 2

I ended up raising a Daycare ticket along with doing some studying and have a better understanding.

I have found that there is a prop on the asset dam:sha1 which contains a hash which in 6.5 i confirmed i can determine via running this on an asset $ shasum -a256 ~/Downloads/asdf.jpg.   I never figured out the algorithm for 6.2 but if i look in the jcr after uploading I can now map this to a file and the bucket the same way.

If you have an asset with eg hash 08550272769f2ded3cd8f3da8d98cad0a5eb8316fa5662b763dca8c71ca055f8 then you can find this on the filesystem in

repository/datastore/08/55/02/08550272769f2ded3cd8f3da8d98cad0a5eb8316fa5662b763dca8c71ca055f8

I can then map this asset to my bucket

aws s3 ls s3://mybucket/0855-0272769f2ded3cd8f3da8d98cad0a5eb8316fa5662b763dca8c71ca055f8

See how the file path maps to the bucket filename and such.

I confused myself a lot switching between 6.2 and 6.5 not sure exactly what the differences are but I now know what I needed to know to solve my problem hope this helps someone else.

Feel free to add on I like learning more.