Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
API with 1 main endpoint:
It would be:
As a input payload API would receive:
As response:
Where the generatedShortUrl would be the new generated url and the id would be to uniquely identify this object (might be useful if API scales in future to offer list of short urls generated by a certain user, for instance or to give capability of deleting the url)
I would use AWS Serverless resources:
The API Gateway would serve as the entry point coming from the internet. It would trigger the lambda where I would have the logic to generate new short urls and store the mapping of the id, long url and short url in there.
And that is it.