Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

How to import assets from S3 Bucket to AEM directly?

Avatar

Level 2

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).

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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?l...

 

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

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

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?l...

 

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

Avatar

Level 2

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"

 

Avatar

Community Advisor

HI @sanjanas3080058 ,

 

If you have input stream of S3 objects. You can also consider using Asset Manager APIs. the method accepts input stream to create asset. Though I have not tried but worth to try.

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...

 

ACS commons is also using the same-

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/ad...

Avatar

Level 2

Hi @Vijayalakshmi_S,

 

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

 

Thanks,

Sanjana

Avatar

Community Advisor

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?