Localstack S3 + AWS CDK on your local with CyberDuck

Kobe
2 min readAug 7, 2021

--

This article shows you how to setup S3 Bucket for local development using LocalStack & AWS CDK

This article is the next for the article setup local stack DynamoDB & AWS CDK repository in section #2 below continue we will set up an S3 Bucket for our development.

Requirement

We need a new S3 Bucket to store user screen sort with some configurations below

  • Bucket Name: screenshot
  • Encryption: Server-side encryption with a master key managed by S3.
import * as s3 from '@aws-cdk/aws-s3';...
...
new s3.Bucket(root, 'screen-shot', {
bucketName: 'screenshot',
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html
encryption: s3.BucketEncryption.S3_MANAGED,
versioned: false,
});

Deploy our Stack

cdklocal deploy

✅ ApplicationStack

How to verify our S3 Bucket setup

Test make sure can upload a file to your S3.

aws --endpoint-url=http://localhost:4566 s3 cp temp/text-test.txt s3://screen-shot

upload: temp/text-test.txt to s3://screen-shot/text-test.txt

You can verify using the below command S3 bucket contains files

aws --endpoint-url=http://localhost:4566 s3 ls s3://screen-shot

2021–08–07 23:47:17 5 text-test.txt

S3 Viewer Tool

Cyberduck is a libre server and cloud storage browser for Mac and Windows with support for FTP, SFTP, WebDAV, Amazon S3, OpenStack Swift, Backblaze B2, Microsoft Azure & OneDrive, Google Drive and Dropbox.

Please refer the Github for this section:

--

--

Kobe

I’m working at KMS-Technology company. I love code (▀̿Ĺ̯▀̿ ̿) — Full Stack Software Engineer