My First Contribution to Serverless Application Repository
Recently, I have created a simple API to retrieve AWS services by it’s regions. And I decide to make it a Serverless Application and now it is generally available to be used by anyone.
Github: https://github.com/pubudusj/serverless-aws-services
How it works
Once you deploy the application using SAM locally or using SAR, there is a API gateway url in the output section. You can directly access the url, which will output JSON response which is in similar structure as below:
{
"last_updated":"2019-10-29",
"data":{
"Alexa for Business":[
"us-east-1"
],
"Amazon API Gateway":[
"ap-east-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-south-1",
"ap-southeast-1",
"ap-southeast-2",
"ca-central-1",
"cn-north-1",
"cn-northwest-1",
...
...
],
...
...
}
}
If you need to have region names instead of region codes, you can append query parameter region_names=true
to the same url so the output will be something similar to below:
{
"last_updated":"2019-10-29",
"data":{
"Alexa for Business":[
"Northern Virginia"
],
"Amazon API Gateway":[
"AWS GovCloud (US-East)",
"AWS GovCloud (US-West)",
"Bahrain",
"Beijing",
"Frankfurt",
"Hong Kong",
"Ireland",
"London",
...
...
],
...
...
}
}
Implementation
Here I used AWS provided Region Table which has all the regions with the available services. I have used python 3.7 with below packages in this project.
- requests - To scrape the web page
- BeautifulSoup - To get the content received by the requests to converted to HTML and get the contents of the tables.
- Pandas - To transform the data in the tables and group them by the region
Demo
You may test the functionality using below end points:
- With region codes: https://aws-services.pubudu.dev/.
- With region names: https://aws-services.pubudu.dev/?region_names=true.
I would like you to try this and let me know your feedback on this.