Generic JasperReports Service using AWS Lambda
This repo contains code for a Java JasperReport Lambda function. It is based on AWS sample code: Jasper Reports with Lambda, RDS and API Gateway
In this case we do not use an RDS connection. The parameters and data sources to include in the report are passed in the body of POST call.
The use of SDK1 has also been changed to SDK2 to increase speed and improve performance.
- Java Maven code
- AWS IaC Files: CloudFormation stack & API swagger
- Test files: JasperReports test template & Postman collection
- Basic scripts to automate process: build application, create AWS buckets, syncronize resources & launch CloudFormation stack
All step scripts uses Docker. No additional software (java, maven or aws-cli) is required.
- Get AWS credentials.
- Modify aws_config/credentials file with correct values.
- Review aws_config/config file to ensure that region is correct.
- Review lambda_config.sh file to ensure correct values for all properties, specially region, files_s3_bucket and templates_s3_bucket. The two last properties must be unique in AWS. Otherwise these cannot be created. See Amazon S3 Bucket Naming Requirements.
- Review jasperreports_stack.yml file to ensure that AvailabilityZone is correct.
- Review lambda_code/src/main/java/potaymaster/aws/lambda/jasperreports/AmazonS3Consumer.java file to ensure that region is correct.
- Set execute permissions to all .sh files.
- Execute 00.launch_all_steps.sh or execute the steps you want.
- When all scripts ends, go to AWS Web Console to check CloudFormation creation stack status.
- Wait until stack creation is complete and go to API Gateway to copy URL.
- Paste API URL into Postman call & launch test example.
- Enjoy !!