This Tool Runs Real AWS Services on Your Laptop For Free (Floci)
BBetter Stack
Computing/SoftwareInternet Technology
Transcript
00:00:00So if you've ever worked with AWS, sometimes you just don't want to do experiments on production
00:00:05servers. So in those cases, you would use something like LocalStack, which helps you validate your
00:00:10code before sending it to the cloud. But a few weeks ago, LocalStack quietly changed their free
00:00:16tier, which is a bummer because a lot of developers genuinely liked it and used it to get around
00:00:21testing things in the real AWS environment. But luckily, now there is a new open source project
00:00:27out there, which is called FlowKey, which is completely free. And it basically does the same
00:00:32things as LocalStack. And it might even genuinely hold up better, to be honest. So in this video,
00:00:38we'll take a look at FlowKey, see how it works and do a little test of our own. Let's dig into it.
00:00:48Quick contacts, if you've never touched LocalStack before, the way it works is that you basically run
00:00:53a fake version of AWS services in Docker on your own machine. So you can develop and test services like
00:01:00S3, DynamoDB, Lambda, whatever. And you don't need an AWS account in the loop at all. But FlowKey's
00:01:08specific claim is that it does all of this without gating half of the useful services behind the paid
00:01:13tier, the way LocalStack does right now. Now looking at their benchmarks, they're stating some pretty bold
00:01:20claims here. 24 milliseconds of startup time, just 13 megabytes of idle memory, and just 19 megabytes for
00:01:27the Docker image size. Now if it really holds up to what they're claiming, then that is a genuinely big
00:01:33deal for anyone running this in CI because container setup time is real money when you're spinning these up
00:01:40hundreds of times a day. So I ran a little benchmark script to verify these claims. So judging by my numbers,
00:01:47neither of them hid their own read me numbers exactly. FlowKey took about 129 milliseconds to startup instead of
00:01:54the claim 24 and LocalStack took almost seven seconds instead of their stated 3.3. So both benchmarks were
00:02:02clearly measured on some sort of best case setup. But looking at the comparison itself, FlowKey is still
00:02:08starting up over 50 times faster than LocalStack, using about 20th of the memory, and the image is quarter of
00:02:15the size. So even with all the marketing optimism included, the actual gap between these two is enormous, and it's in
00:02:23Floki's favor. So they do indeed have really good numbers as they listed. Okay, so the numbers mostly check
00:02:29out. So that's awesome. But now let's test it out with a real scenario. So you can get started with Floki by just running this
00:02:36simple one-liner docker command, and this will create a new AWS environment on your local machine.
00:02:42And now that we have it up, we can do most of the things you would normally do in an AWS CLI console.
00:02:48I can run AWS S3 MB, I can spin up a new S3 demo bucket, and I can also run AWS DynamoDB create table, and this will
00:02:59create a new demo table with DynamoDB. And then just to double check, if we run AWS DynamoDB list tables,
00:03:07there it is, our table that we just created. So if you've used LocalStack before, this is going to feel
00:03:14very similar. But basic bucket creation on an empty DynamoDB table isn't really an interesting test case.
00:03:21The actual pitch Floki is making against LocalStack is that a bunch of their services aren't just
00:03:27shallow mocks, they're running the real thing in a container. So to test it out end-to-end, I built a
00:03:33little image thumbnail generator project, and this is basically the kind of unified AWS pipeline you'd actually
00:03:39build in a real project. You drop an image into an S3 bucket, that triggers a Lambda function, the Lambda
00:03:46resizes it, and writes the thumbnail to a second bucket, and logs the metadata, like dimensions, file size,
00:03:53timestamp, into DynamoDB. So let's actually run this thing. I've got two terminals open here. One is going
00:04:00to run Floki docker setup, and the other is going to be where I fire up all the execution commands.
00:04:06So when you run docker compose up, Floki pulls its image and starts right up, and over here I'm running
00:04:12a setup script that builds out the actual architecture. Nothing too fancy, just the classic file uploader
00:04:19pattern. It creates two S3 buckets, one for uploads and one for thumbnails, a DynamoDB table to hold the
00:04:26metadata, and it deploys a real Lambda function that's supposed to generate the thumbnails of our images.
00:04:32So let's actually test it. So I'm uploading a photo of a dog here straight into that upload bucket, and this
00:04:37is the part I actually like. Floki isn't faking the Lambda execution. If you watch the other terminal,
00:04:43it's pulling the real Lambda Python runtime image and spinning up an actual docker container to run the
00:04:50function in the same way Lambda would on AWS. Then it runs it, and then it tears the container down right
00:04:57after. So that is a proper emulation. So the function resized the image, wrote the metadata record into
00:05:03DynamoDB. So we can see original size, thumbnail size, dimensions, timestamp, and then it dropped the
00:05:09actual thumbnail into the second bucket. Now Floki also ships a web UI where you can browse everything
00:05:15you just spun up. So right now on the storage, you can see the three buckets that we created. And if we
00:05:22click into the thumbnails bucket, there's the file that Lambda actually generated, 3.7 kilobytes,
00:05:29timestamped, exactly like you'd see in a real S3 console. Switching over to DynamoDB, and here's the
00:05:35metadata table with the one record we just wrote. Same JSON that we saw in the terminal, just fully
00:05:42visible here in the browser now. And on the serverless section, there's an actual Lambda function config,
00:05:47memory, timeout, the deployment package, plus a built-in way to invoke it directly from the browser
00:05:53with a custom JSON payload, if you want to test it without touching the CLI at all. So there you go,
00:05:58we have successfully emulated a full AWS stack locally on our machine. And if you're already on local
00:06:06stack and thinking about switching over to Floki, the migration is really straightforward. You just need
00:06:12to grab the Docker compose file that was already pointed at your local stack setup, swap one line,
00:06:18and that's it. And if you're testing Lambda function specifically, and you use test containers, Floki
00:06:24ships a module for that too. So you can spin this whole thing up and tear it down inside an actual test
00:06:31suite instead of managing a separate container yourself. So there you have it, folks. That is
00:06:36Floki in a nutshell. It really looks like a very promising alternative to local stack. And I love
00:06:42that it is fully open source and free to use. But in order for them to grow and maintain a good product,
00:06:48they do need some sponsorships. So if you're genuinely interested in the project, consider donating to
00:06:54their cause. That's how we're all able to keep the open source community thriving. But what do you folks
00:07:00think about Floki? Have you used it? What are your impressions? Do you see any downsides to Floki over
00:07:06local stack? Let us know in the comments section down below. And folks, if you like these types of
00:07:12technical breakdowns, please let me know by smashing that like button underneath the video. And also don't
00:07:17forget to subscribe to our channel. This has been Andres from Betterstack and I will see you in the next videos.
Community Posts
No posts yet. Be the first to write about this video!
Write about this video