Skip to content
About Me
Template: About me
Healthcare Application Development – Why it is Required in the Healthcare Business?
Pool Vehicle Management System to Optimize Your Employee Transportation
4 Strategies to Adopt for Maximum Fleet Utilization
How can NEMT Provide Assistance to Medical Transportation Services?
Technology and Patient Care: Achieving the Right Balance for Improved Patient Experiences
Data Privacy in Healthcare: A Necessity in Protecting Health Information Data
Automating Electronic Data for MCOs with Transportation Technology Services
Apple WWDC Event 2022 Keynote Highlights: Complete Announcement of Apple’s Newest Launches on Day 1
Apple WWDC Event 2022: A Synopsis from Day 4
Apple WWDC Event 2022: Summarization of Day 5
Software Development in Healthcare Refining Application Maintenance in the Industry
Healthcare Transportation Services: EMS vs. NEMT What is the Difference?
Route Optimization Software: A Smart Way to Optimize Your Transportation Business
Essential Factors to Consider When Choosing An Event Transportation Management Solution
Predictive Analytics in Healthcare Ensuring Seamless Rides for Patients
iOS 16 Update: Top 12 Unique Features Coming to Your iPhone
A Must-follow Guide to Low Code Development
Android 13 Features and Changes: Check What’s New
How to Select the Right NodeJS Development Company
Patient Scheduling Software: 9 Ways to Improve Scheduling Patient Appointments
A Complete Guide to Employing the Best MEAN Stack Developers for Your Next Project
A Complete Guide to Regression Testing
Digital Healthcare Services – Elevating Telehealth Innovation in Rural Communities
iOS 16 Update: Top 13 Exciting Features Bringing Big Changes to Your iPhone
How to create REST API using AWS SAM CLI and Java with CORS support
IoT in Healthcare Elevating Hospital Workflow with Innovative Medical Solutions
How the Metaverse Will Change Transportation and Future Mobility

How to create REST API using AWS SAM CLI and Java with CORS support

AWS SAM stands for AWS Serverless Application Model. It is created by AWS to make deployment of AWS Lambda functions easier. With AWS SAM you can describe your serverless application as a YAML file. Then using AWS SAM CLI, you can use this YAML file to deploy all the necessary AWS resources required by your application. Under the hood, AWS SAM CLI generates a Cloud Formation template, which is then used to create and modify the resources required for the application.
In this article we will see how to create a REST API using AWS SAM CLI using the Java programming language. There are some tutorials on the web which show this, however these tutorials don’t show how to handle some common aspects such as CORS implementation. Recently I had to deploy a quick API using AWS SAM and Java, however, I couldn’t find an easy to follow tutorial on how to handle CORS implementation with this. After doing some trial and error with some Stack Overflow answers, I managed to get it to work properly. Hence I thought it’s better to write a tutorial to cover CORS implementation also along with a basic REST API. So let’s get started.
Before starting you will need to ensure that you have , and
installed and configured on your system. For this tutorial I am using JDK 11. As of September 2022, it seems that AWS Lambda doesn’t support JDK 17 runtime. This may change in future. If you want to test your API locally, you will also need installed. Also ensure that you have to use with your AWS CLI using the aws configure command.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.