Coder Social home page Coder Social logo

aws-s3-example's Introduction

AWS S3 Example

使用localStack本地开发测试

LocalStack 是一个云服务模拟器,可以在笔记本电脑或 CI 环境中的单个容器中运行。借助 LocalStack,可以在本地使用AWS Rust SDK进行基于AWS云服务的开发测试,无需链接到WAS云服务,节省成本,便于开发测试。

Install LocalStack

Linux

Download:

curl -Lo localstack-cli-3.3.0-linux-amd64-onefile.tar.gz \ https://github.com/localstack/localstack-cli/releases/download/v3.3.0/localstack-cli-3.3.0-linux-amd64-onefile.tar.gz

Extract the CLI:

sudo tar xvzf localstack-cli-3.3.0-linux-*-onefile.tar.gz -C /usr/local/bin

Check the CLI version:

localstack --version

# output:
3.3.0

Start The LocalStack

Launch the LocalStack

localstack start

Check the LocalStack status

curl http://localhost:4566/_localstack/info | jq

# output:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   271  100   271    0     0  83282      0 --:--:-- --:--:-- --:--:-- 90333
{
  "version": "3.3.1.dev:693772f27",
  "edition": "community",
  "is_license_activated": false,
  "session_id": "3ccda464-e803-4d21-b3ba-dd25d94d42c5",
  "machine_id": "dkr_49ff3d908e17",
  "system": "linux",
  "is_docker": true,
  "server_time_utc": "2024-04-01T18:40:42",
  "uptime": 73
}

LocalStack部署在远程服务器

⚠️启动的localstack工具拉起的 Docker容器绑定到主机127.0.0.1:4566,只能本地访问,如果想把localstack部署在其他机器上请在部署的机器转发一下请求,例如使用socat工具:

socat TCP-LISTEN:8090,fork TCP:127.0.0.1:4566

其S3客户端问该主机的ip:8090,然后socat转发到本地的127.0.0.1:4566,这样就能供其他机器的S3客户端访问该主机上Docker容器内的localstack服务了。

Running S3 Getting Start

如果你的localstack部署在本地,并且使用默认端口,那么启动后可以直接运行S3-Getting-Start测试

cd examples
cargo run --bin s3_getting_started

aws-s3-example's People

Contributors

captainlee1024 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.