How to import assets from S3 Bucket to AEM directly? | Community
Skip to main content
sanjanas3080058
Level 2
June 22, 2021
Solved

How to import assets from S3 Bucket to AEM directly?

  • June 22, 2021
  • 3 replies
  • 4566 views

Hi All,

We are trying to upload assets from S3 bucket to AEM through AWS Lambda Functions.

Was trying through curl command ,solution seems to be not working for this setup as we need to convert the input stream of S3 Object to file and then write to AEM instance. But the problem is we will not be able to save the converted file in any temp location as the standalone Java code will be triggered from AWS Lambda.

 

Could you please let us know if there is any approach to upload the assets to AEM from S3 directly? Please note that we need to upload assets selectively based on some conditions which we are handling in AWS Lambda (Standalone Java Class).

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ritesh_Mittal

Hi @sanjanas3080058 ,

 

You can use Asset HTTP API available. we have CRUD operations support for all REST operations.

 

Please refer this video-

https://www.youtube.com/watch?v=Yn7ybOwfIYY

 

Reference-

https://experienceleague.adobe.com/docs/experience-manager-65/assets/extending/mac-api-assets.html?lang=en

 

Also, I believe you can use S3 Asset Ingestor utility since you have some conditions written in AWS lambda.

3 replies

Ritesh_Mittal
Community Advisor and Adobe Champion
Ritesh_MittalCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
June 22, 2021

Hi @sanjanas3080058 ,

 

You can use Asset HTTP API available. we have CRUD operations support for all REST operations.

 

Please refer this video-

https://www.youtube.com/watch?v=Yn7ybOwfIYY

 

Reference-

https://experienceleague.adobe.com/docs/experience-manager-65/assets/extending/mac-api-assets.html?lang=en

 

Also, I believe you can use S3 Asset Ingestor utility since you have some conditions written in AWS lambda.

sanjanas3080058
Level 2
June 23, 2021

Hi @ritesh_mittal,

 

Thanks for your reply. Can we access the S3 Asset Ingestor utility programatically?

Also I tried to make use of Assets HTTP API's below request, but the problem I am facing is that from S3 bucket I would be getting it as input stream and if you notice "@myPicture.png" would be an actual file. I tried sending the inputstream directly but that would give me a bad request error. Any help would be really appreciated 🙂

Create an asset

Place the provided file at the provided path to create an asset in the DAM repository. If a * is provided instead of a node name, the servlet uses the parameter name or the file name as node name.

Parameters: The parameters are name for the asset name and file for the file reference.

Request

  • POST /api/assets/myFolder/myAsset.png -H"Content-Type: image/png" --data-binary "@myPicture.png"

 

sanjanas3080058
Level 2
June 23, 2021

Hi @vijayalakshmi_s,

 

Could you please take a look at this and provide me your inputs?

 

Thanks,

Sanjana

Vijayalakshmi_S
Level 10
June 23, 2021

Hi @sanjanas3080058,

Is it possible for you to provide details on

  • Conditions that we are trying to check in Lambda function.
  • And this flow from S3 to AEM is a one time activity? 
  • AEM version. Do you foresee use of AEMasCS in future?