Slide 1

Slide 1 text

Personal development of an intrusion detection system using Amazon Location Service. BXT KBXTVH KBXTQBOLSBUJPO"846TFS(SPVQT BXTDPNNVOJUZ TPSBDPN JAWS PANKRATION 2021 Kenichiro Wada@Keni_W

Slide 2

Slide 2 text

"HFOEB KBXTQBOLSBUJPO • Self Introduction • Why did I make it? • System Description • Rebuild with AWS CDK • What to do if you are outside Japan? • Impressions

Slide 3

Slide 3 text

Self Introduction Kenichiro Wada iret, inc.(cloudpack) ʻs Engineers JAWS-UG Chiba Core member SORACOM UG Tokyo Core Member My favorite AWS Service ʻ s AWS Lambda 2021 APN AWS Top Engineers I wrote a book about serverless with my colleagues in 2020.

Slide 4

Slide 4 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • Right now, I work from home most of the time, while my wife goes to work at the office. • When I am doing things at the time my wife comes home, it is something of a hassle to deal with.

Slide 5

Slide 5 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • I hope they'll call me when they come back, but that's not always the case. • I thought about giving my wife a button-type device and having her press it when she leaves, but I think she probably won't do it.

Slide 6

Slide 6 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • Eventually, I thought it would be nice to automatically know when my wife was coming home, and that's when the idea came about. • The title says "intrusion detection", but "coming home detection" may be correct.

Slide 7

Slide 7 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • When I was thinking about how to make it, there was a study session about Amazon Location Service, and I thought it would be possible to use Amazon Location Service, so I signed up for LT and started making it.

Slide 8

Slide 8 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • So, this system was made as part of the "LT Speaking driven development". • I'm also trying to see how much I can build with AWS CDK, which I've been using for work recently.

Slide 9

Slide 9 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • The details of the service we are using will be published in a later article. • You can find more information about what we have created here. https://github.com/Kenichiro-Wada/amazon- location-service-geofence-system

Slide 10

Slide 10 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO Configuration diagram (Location information input section)

Slide 11

Slide 11 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • A device with built-in battery equipped with temperature, humidity, acceleration sensor and GPS released by SORACOM Inc. • A very useful device that can be easily visualized in combination with SORACOM services (Sorry, only in Japan.)

Slide 12

Slide 12 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • The data from the GPS multi-unit will be set from SORACOM Funk to AWS Lambda's Event object.

Slide 13

Slide 13 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • Since lat (latitude) and lon (longitude) are contained in the Event object, they are set in the location.batchUpdateDevicePosition parameter (Positon) and submitted. const devicePostion = { DeviceId: deviceId, Position: [ event.lon, event.lat ], SampleTime: moment(date).toISOString() }

Slide 14

Slide 14 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO Configuration diagram (Notification section)

Slide 15

Slide 15 text

4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • When an event (ENTER/EXIT) occurs in GeoFence, a Lambda function will be executed. • Since the event information is in the Event object, it will be processed to generate a message and send a notification to LINE.

Slide 16

Slide 16 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO

Slide 17

Slide 17 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO

Slide 18

Slide 18 text

8IZEJE*NBLFJU KBXTQBOLSBUJPO • The following are possible use cases for the application of this system. • Deploying GeoFence at home and at school to automatically watch over children going to and from school

Slide 19

Slide 19 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • When I built the system once, I used the Management Console. • This time, I decided to build it using AWS CDK, which I have been using in my work recently.

Slide 20

Slide 20 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • Open the Location (AWS Location Service) overview page in the AWS CDK API reference... Is this all?

Slide 21

Slide 21 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • For AWS Lambda, it looks like this...

Slide 22

Slide 22 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • I thought it would be nice to have at least a sample, but anyway, I implemented it while looking at the documentation and finished it.

Slide 23

Slide 23 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • The source is available at 「lib/amazon-location-service-with- soracom-stack.ts」on Github.

Slide 24

Slide 24 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • What we did with AWS CDK • Build Map, GeoFenceCollection, Tracker, and Consumer • Deploying AWS Lambda functions • Create EventBridge rules

Slide 25

Slide 25 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • Using the AWS CLI • Submitting GeoFence location information • Put the Line Notify Token into the System Manager parameter store as a SecureString

Slide 26

Slide 26 text

3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • Using the Management Console • Testing AWS Lambda • Checking Lambda logs in Cloudwatch Logs

Slide 27

Slide 27 text

What to do if you are outside Japan? KBXTQBOLSBUJPO • GPS Multi-Unit is a device that is available only in Japan. • Since there are devices equivalent to GPS multi-units, it is possible to achieve this by throwing the device to a unified endpoint on the SORACOM platform.

Slide 28

Slide 28 text

KBXTQBOLSBUJPO What to do if you are outside Japan? • It's going to be a matter of sending data from the device to AWS IoT Core and triggering Lambda to feed it into Location Service.

Slide 29

Slide 29 text

*NQSFTTJPOT KBXTQBOLSBUJPO • I think Amazon Location Service is an interesting service. • I was able to easily create a service using GeoHence. • I think I can combine it with Amplify Geo, so it will be easy to visualize.

Slide 30

Slide 30 text

*NQSFTTJPOT KBXTQBOLSBUJPO • AWS CDK, a terribly easy environment to build. And it can be destroyed. • I'm someone who has never created a CloudFormation template, but it looks like I never will. • It's a bit annoying that it's updated too frequently, and strange errors occur due to version differences.

Slide 31

Slide 31 text

&OEJOH KBXTQBOLSBUJPO Thank you for listening.