DEV Community

Cover image for AWS Location Service: Where my AWS Community Builders at?
Jared Donboch for AWS Community Builders

Posted on • Updated on

AWS Location Service: Where my AWS Community Builders at?

TLDR; I built a map of AWS Community Builders using AWS Location Services. Click here for the map, click here for the code.


I was recently accepted into the AWS Community Builders program and have been blown away by how geographically diverse the group is. The program is split up into different technology-based cohorts--although this is very loose coupling and members are free to join discussions and sessions for any set of technology they are interested in--but there is no location based grouping.

This led to many asking the same question: are there any other AWS Community Builders near me?

The manager of the program, Jason Dunn, agreed to share some anonymized location data with me and I volunteered to draft a quick proof-of-concept map that would display the locations.

I initially implemented this via Google Maps JS API (code can be found here) but with the release of AWS Location Service, I decided it was worth trying to experiment with this new service.

What is Amazon Location Service?

Amazon Location Service is a new set of resources to support maps and location-based use cases such as geocoding, routing, asset/device tracking and geo-fence events.

As of the writing of this, the AWS Location Service has been GA for less than 2 weeks. I look forward to new features and integrations that will inevitably come in the future as the service continues to get some exercise.

Initial Impressions (of Maps and Geocoding)

Here are my initial impressions. I have only really experimented with maps and geocoding to support this simple use case.

The routing, tracking and geofencing components look very interesting but I don't have any direct experience with them yet.

Good: Great integration with other AWS Services

If you are already in the AWS eco-system, using Amazon Location Services will be very easy as you can continue to use the tools and SDKs you are already using. You can control access and security via IAM, automate deployments via CloudFormation, monitor with CloudWatch, be notified of location-based events via Amazon EventBridge, etc.

Good: Creates an abstraction for various location providers.

Amazon currently supports its clients using Esri or HERE data sets and services. When you create Amazon resources for maps, places, etc you choose which provider you want to supply the data. Each provider has their own strengths and weakness but you can now switch easily without needing to integrate with each unique location provider API. As new providers are added, you can continue to leverage the same interface.

Good: Better privacy and security

AWS does not have rights to sell your data or use it for advertising purposes (can Google say that?). They also anonymize all your requests before submitting them to vendors. Any tracking and geofence data is stored only in your AWS account (not 3rd parties) which gives you the power to control and secure that information.

Not so good: Free Tier/Pricing

AWS offers a free tier but it is only a 3-month trial. After 3 months, you are on the hook for your requests based usage. Google Maps free-tier equivalent (free mobile usage and $200 maps credit each month) does not expire and is much more generous. The maps and geocoding prices are competitive with other services but Amazon charges on a per-tile basis when many other providers charge on a per map-load basis. This means if your users are zooming and panning frequently, you will likely be paying more for Amazon Location Services.

This pricing makes Amazon Location Services a little less desirable for individuals, small prototyping efforts, and mobile map applications that are extremely price sensitive as you'll probably end up paying when other providers (i.e. Google) you can do a lot more with their free tier.

I hope that Amazon creates a more permanent free-tier for the mapping service at least.

#### Not so good: Lacking access controls for anonymous access to public maps.
Amazon Location Services provides an API that can be connected to other map libraries (i.e. MapLibre and Tangram). This is sort of nice but it requires you to use a Cognito Identity Pool with anonymous access enabled if you want to display on a public website. This is well documented in their developer guide but I feel like there are some access-controls lacking as there is no way to lock down your anonymous credentials to a particular IP or HTTP referrer like you can do with Google's API Keys. This means someone could grab the Cognito Identity Pool ID from the Javascript source code in the browser and use it for their own map requests. This seems like a big flaw and hoping some additional Conditional support could be added to IAM policies to better control anonymous access.
Someone pointed me in the right direction here and this is possible: check out my article here on how to lock down AWS Location Service by referer or IP, similar to Google Maps API keys.

Creating the map and geocoding the data

To complete this proof of concept, I needed the following:

Given a list of locations, I needed to 1) geocode the locations to get their latitudes and longitudes and then 2) create a static map webpage to display the locations as markers on a map. Bonus points if we can add some metadata on the markers.

The map

There was not much innovation for the map part of the project and just a quick proof of concept was the goal. It was accomplished by walking through the following sections of the AWS Location Service Developer Guide which is a great resource to get started! :

I also used some MapLibre tutorials below to help create the markers, icons and pop ups on the map:

The geocoding process

We need to create a Place Index resource to support the geocoding.

To do the geocoding and create the GeoJSON that is displayed by the map, I wrote a quick Python script to perform that. This was fairly easy since the geocoding actions have been added to boto3 (i.e. the Python AWS SDK).

Unfortunately, the only location information that we had for Amazon Community Builders was Country. This resulted in many duplicate markers being generated which the mapping library was not happy about. In the end, I adjusted the logic of the geocoding script to create a single point for each country but then add properties to the point that indicated the number of people in that country. This member count property could then be displayed as a pop up on the map when the user hovered over the map marker.

Final Results

To see the final code and the geocoding script, check out the acbmap-aws repo on GitHub. I tried to add more details to that README with the specifics if you want to try and run this locally.

You can find the a hosted version of the AWS Community Builders map, powered by Amazon Location Services, at the following location:

https://acbmap.humbleg.com/aws/

Top comments (10)

Collapse
 
jasondunn profile image
Jason Dunn [AWS]

Amazing - thank you for creating this! 👏

Collapse
 
skabba profile image
Enri Peters • Edited

Great article, I stumbled on this because I had a similar idea. Thank you for writing.

There appear to be around 2350 CB worldwide at the moment of writing.
That leaves me wondering why the public CB directory only shows around 1300 of them. Did they not all completed the process of registering for the public directory? Can you elaborate on this @jasondunn ?

I guess I already found the answer (it's written on the CB directory homepage): This directory contains all Community Builders who have chosen to be listed publicly.

Collapse
 
jasondunn profile image
Jason Dunn [AWS]

Hi Enri. As you saw, the public CB directory is an opt-in list, so it will never be the definitive list of everyone in the program. We are adding a new group of people early next month as the opt-in process is currently running.

It's also worth noting that the DEV community here is everyone who has ever joined the DEV org as a CB; it's more of an existing and alumni list.

Collapse
 
skabba profile image
Enri Peters

Thank you for replying @jasondunn, much appreciated.

Collapse
 
abdullahparacha profile image
Abdullah Paracha

More than awesome! more power to you man

Collapse
 
moneerrifai profile image
Moneer

This is awesome! Just looked at the code and it is pretty straightforward. This will be a nice service to integrate with other projects!

Collapse
 
tacck profile image
Kihara, Takuya

This is a great work of Amazon Location!

Collapse
 
pablosalas81 profile image
pablosalas81

Great work, congrats

Collapse
 
md__mostafa profile image
Md. Mostafa Al Mahmud

Wow... CB's global map. It's really amazing! 👏 Thanks for sharing.

Collapse
 
raqsmarasigan profile image
Raqs

Thank you for work was able to create Amazon Quicksight EDA 101 dev.to/aws-builders/eda-101-using-...