Skip to main content

3 posts tagged with "Hardware"

View all tags

I Built a Cloud Storage Service with AWS Serverless

· 3 min read
ひかり
Main bloger

Introduction

I wanted a personal file sharing system, so I built a file storage service using only AWS serverless services.

In this article, I'll walk through the key design decisions and the actual architecture I ended up with.

What I Built

The cloud storage service that lets you upload, download, and manage folders through a web browser.

Key Features

  • File upload / download
  • Folder creation and hierarchical management
  • Bulk ZIP download of multiple files / folders
  • User authentication (sign-up, login, password reset)
  • User profile management

Architecture

Here's the architecture diagram.

Most of the authentication is handled by Cognito. For file transfers, Lambda issues S3 Presigned URLs so the client communicates directly with S3.

Tech Stack

LayerTechnology
BackendC# (.NET 8) / AWS Lambda
AuthenticationAmazon Cognito + Managed Login v2
APIAPI Gateway (REST) + Cognito Authorizer
StorageAmazon S3

Design Decisions and Reasoning

Using Cognito for Authentication

I leveraged Cognito's OAuth 2.0 endpoints and Managed Login to implement authentication.

In the end, I only needed a single Lambda function for auth: TokenFunction.

In terms of both functionality and security, less code is better. There's no need to write what AWS services already do for you.

File Transfers via Presigned URLs

Routing file uploads and downloads through Lambda introduces several problems:

  • Hitting Lambda's payload size limit
  • Loading large files into Lambda memory is costly
  • Transfer time counts against Lambda execution time

With Presigned URLs, Lambda only issues the URL — the actual file transfer happens directly between the browser and S3.

Lambda execution time stays in the tens of milliseconds, and the file size limit extends all the way to S3's own limits.

Upload flow:
1. Browser → Lambda: "I want to upload file.pdf! Send me an upload URL."
2. Lambda → Browser: "Here's a Presigned URL. PUT your file here."
3. Browser → S3: "Sending PUT to S3."
4. Browser → Lambda: "Upload complete!"

ZIP Download for Folders

S3 doesn't have a built-in feature to download an entire folder.

For bulk downloads, I generate a ZIP file in Lambda, temporarily store it in S3, and return a Presigned URL for it.

The temporary ZIP file is automatically deleted after 1 day via an S3 lifecycle rule, so there's no garbage buildup.

Security

MeasureImplementation
Brute-force protectionCognito's built-in lockout (5 failures: 15-minute lock)
API protectionJWT verification via Cognito Authorizer
CORSAllowedOrigin restricted to a specific domain
Temporary file managementS3 lifecycle rule auto-deletes files after 1 day

Cost

With a serverless architecture, costs are nearly zero when not in use.

  • Cognito: ESSENTIALS Tier is free up to 10,000 MAU
  • Lambda: Free up to 1 million requests per month
  • S3: Pay-as-you-go based on storage used (~$0.025/GB per month)
  • API Gateway: $3.50 per 1 million requests

For personal use, monthly costs should land somewhere between a few cents and a couple of dollars.

Infrastructure as Code

The entire infrastructure is defined in a single template.yaml (AWS SAM).

Cognito User Pool, API Gateway, 3 Lambda functions, S3 bucket, CloudWatch alarms, SNS — all resources defined in roughly 600 lines of YAML.

Libertouch ES (JP) Review

· 2 min read

Libertouch ES

I got the Libertouch ES Japanese Layout (NC07902-B281-ES).

Libertouch ES

Libertouch ES

Here are my honest impressions after about one month of use.

Strengths

  • Typing experience
    Top-tier among membrane keyboards. Keys feel natural and have a light, mechanical-like touch without actually being mechanical. I hope they stick with membrane switches.
  • Durability
    Aluminum construction makes it extremely sturdy. Almost like a bludgeon.
  • Cherry MX compatible keycaps
    It's great that keycaps are replaceable.

Areas for Improvement

  • Unreliable input recognition
    Some keys don't respond when pressed, and it seems like multiple keys are swapping inputs. Likely a firmware or software issue.
  • Keycaps come off easily
    Due to structural design, spacebar and enter key detach frequently. Feels unstable.
  • Need replacement keycaps
    A key remapping tool is available, which is good, but replacement keycaps are needed. The left Windows key especially seems to have high demand. Ideally Home and End keys too.
  • Better cable options needed
    The included cable is USB-C to USB-C. Since most computers use USB-A, a USB-A to USB-C cable would be preferred.
  • Price is high
    At 80,000 yen as a prototype, the cost is understandable. If all issues were resolved and the price dropped to the 30,000 yen range, I'd buy it.

Overall Assessment

The Libertouch ES is a high-quality membrane keyboard with excellent tactile feedback and durability. However, it has practical concerns: unreliable input recognition, easily detachable keycaps, and cable compatibility issues. More replacement keycap and cable options would increase its appeal. Full-size or 80% layout options would be welcome. There's likely more demand for these than 65%.

Looking forward to improvements and release!

USB 3 and Type-C explained

· 4 min read

USB is a standard for connecting devices such as PCs and smartphones, but the types and performance are diverse, and it can be difficult to choose which one to choose. Therefore, we explain Type-C and USB 3, which are often heard about with USB, and also introduce how to choose a cable.

What is Type-C?

Type-C is one type of connector shape for USB. Compared to the conventional Type-A and Type-B, Type-C has a small design and a convenient feature that allows connection from either direction. Also, Type-C has functions such as power supply and video output, and if it is supported, it can be connected to peripherals such as monitors and docking stations. However, it is important to note that not all cables have video output or high-speed communication capabilities. Therefore, there are also Type-C cables with slow USB 2.0 communication.

The relationship between Thunderbolt and Type-C

Thunderbolt has the same shape as Type-C, but the functions are different. In addition to normal data transfer, Thunderbolt can do the following:

  • High-speed communication (Thunderbolt 3: 40 Gbps)
  • Video output (DisplayPort)
  • High current

What is USB 3?

USB 3 is a standard that improves the transfer speed and power supply capability of USB. USB 3.0 has a maximum transfer speed of 5 Gbps, USB 3.1 has a maximum transfer speed of 10 Gbps, and USB 3.2 has a maximum transfer speed of 20 Gbps. Also, USB PD (Power Delivery) technology has been introduced from USB 3.1, and it is now possible to supply up to 100 W of power.

The complexity of USB 3 standards

Due to the history of name changes with each version update, the names of USB 3 standards have become complicated. Below is a summary of USB standards. Items in the same row are the same standard.

Common nameOld old nameOld nameStandard nameSpeed
USB 2.0-----480 Mbps
USB 3.0USB 3.0USB 3.1 Gen 1USB 3.2 Gen 15 Gbps
USB 3.1-USB 3.1 Gen 2USB 3.2 Gen 110 Gbps
USB 3.2--USB 3.2 Gen 2x220 Gbps

How to choose a Type-C cable

When choosing a USB cable, first check whether it meets the standard suitable for the device you want to connect and your purpose. If you want high-speed data transfer or high-quality video output, it is good to choose a Type-C cable or Thunderbolt cable that supports USB 3.2 (USB 3.2 Gen 2x2). Also, if you want to supply power or charge, it is good to choose a Type-C cable that supports USB PD. However, it is important to note that the connected cable and the connected device must be the same standard.

Choosing a Thunderbolt cable

Thunderbolt cables are the strongest and most expensive cables among Type-C cables in terms of high performance.

Be careful of suspicious products

There are genuine Thunderbolt cables and fake Thunderbolt cables. A simple way to distinguish them is that Thunderbolt cables have a lightning bolt mark, and those without a mark or with the number 40 written on them are fake. Also, be careful, as cables that say "Thunderbolt compatible" are likely to be fake.

By the way, I purchased the following cables last month.

Type-C adapters

Type-C adapters exist. For example, the following:

These are used to connect Type-A devices to smartphones and PCs that only have Type-C ports.

Out Type-C adapters

Female Type-C adapters are out. For example:

  • Type-C female to Type-A male
  • Type-C female to Type-C male

It is preferable not to buy C to A adapters because they violate the standard.