Servicenow and Aws S3 integration
AWS S3 is the leader in enterprise storage solution available in the market, and due its robust architecture, it is very likely that you will stumble upon its integration with other tools such as servicenow. Community also has many open question about this very topic so, I decided to create an easy to use solution.
Problem statement : Upload servicenow attachment to AWS S3 or, download any file from AWS S3 to servicenow as attachment
Challenges : AWS has a very unique authentication method called AWS Signature which is complex as mentioned in below screenshot
Alternatives ?
1- Servicenow OOB spokes available to let you do this seamlessly via integration hub (paid subscription)
2- You have an alternate approach called lambda and API gateway, where you can just "x-api-key" as authorization header and, get things done however, it has a limitation on file size (10 MB max) and additional cost (dirt cheap though) for lambda and API gateway.
Solution: I have developed a solution as a scoped application (CryptoJS needs to be imported as a scoped script include), The solution is ready to use with low code approach.
Technical design
Features
- Allows you to upload any attachment from ServiceNow to any S3 bucket/folder.
- Allows you to download any file from S3 bucket/folder to any ServiceNow record
- Supports S3 sub directories.
- No external dependencies
Setup :
Import the updateset and commit it
Update the below system properties:-
1-) x_158350_amazonuti.aws.access.id // update the value of the property with aws access key
2-) x_158350_amazonuti.awsSecret.key // update the value of the property with aws secret key
Refer amazon blog on access and secretkeys "https://aws.amazon.com/blogs/security/wheres-my-secret-access-key/"
Usage:
To Upload an attachment from ServiceNow
new x_158350_amazonuti.s3Upload().fileUpload(""," ", "", "");
Example:
new x_158350_amazonuti.s3Upload().fileUpload("rahul.jpg","snaws2", "us-east-2","e72778e7db1860105c57e4da4b9619e4"); //
To download a file from s3 to ServiceNow as an attachment
Usage:
new x_158350_amazonuti.s3Download().fileDownload(""," ", " ", "
","");Example:
new x_158350_amazonuti.s3Download().fileDownload("test.pdf","packagesrp", "us-east-1", "incident","9c573169c611228700193229fff72400");
This can be downloaded from servicenow share https://developer.servicenow.com/connect.do#!/share/contents/3490912\_servicenow\_to\_s3\_integration?t=PRODUCT\_DETAILS
Hopefully this will help the community.
https://www.servicenow.com/community/developer-articles/servicenow-and-aws-s3-integration/ta-p/2305506