Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Personal development of an intrusion detection system using Amazon Location Service. /jaws-pankration-2021

Personal development of an intrusion detection system using Amazon Location Service. /jaws-pankration-2021

665aa20c57717b4f34d0635308d272f7?s=128

Kenichiro Wada

November 20, 2021
Tweet

Transcript

  1. 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
  2. "HFOEB KBXTQBOLSBUJPO • Self Introduction • Why did I make

    it? • System Description • Rebuild with AWS CDK • What to do if you are outside Japan? • Impressions
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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
  10. 4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO Configuration diagram (Location information input section)

  11. 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.)
  12. 4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO • The data from the GPS multi-unit will

    be set from SORACOM Funk to AWS Lambda's Event object.
  13. 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() }
  14. 4ZTUFN%FTDSJQUJPO KBXTQBOLSBUJPO Configuration diagram (Notification section)

  15. 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.
  16. 8IZEJE*NBLFJU KBXTQBOLSBUJPO

  17. 8IZEJE*NBLFJU KBXTQBOLSBUJPO

  18. 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
  19. 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.
  20. 3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • Open the Location (AWS Location Service) overview

    page in the AWS CDK API reference... Is this all?
  21. 3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • For AWS Lambda, it looks like this...

  22. 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.
  23. 3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • The source is available at 「lib/amazon-location-service-with- soracom-stack.ts」on

    Github.
  24. 3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • What we did with AWS CDK •

    Build Map, GeoFenceCollection, Tracker, and Consumer • Deploying AWS Lambda functions • Create EventBridge rules
  25. 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
  26. 3FCVJMEXJUI"84$%, KBXTQBOLSBUJPO • Using the Management Console • Testing AWS

    Lambda • Checking Lambda logs in Cloudwatch Logs
  27. 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.
  28. 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.
  29. *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.
  30. *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.
  31. &OEJOH KBXTQBOLSBUJPO Thank you for listening.