Developing an AI application locally using AWS Chalice

First, let's implement the private APIs and services that provide common capabilities. We will have two services; both of them should be created in the chalicelib directory:

  1. StorageService: The StorageService class that's implemented in the file connects to AWS S3 via boto3 to perform tasks on files we need for the applications.

Let's implement StorageService, as follows:

import boto3class StorageService:    def __init__(self, storage_location):        self.client = boto3.client('s3')        self.bucket_name = storage_location    def get_storage_location(self):        return self.bucket_name    def list_files(self):        response = self.client.list_objects_v2(Bucket = self.bucket_name)        files = []

Get Hands-On Artificial Intelligence on Amazon Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.