aws
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAWS Emulator
AWS 模拟器
S3, SQS, IAM, and STS emulation with AWS SDK-compatible S3 paths and query-style SQS/IAM/STS endpoints. All state is in-memory, and responses use AWS-compatible XML.
提供与AWS SDK兼容的S3路径和查询式SQS/IAM/STS端点,实现S3、SQS、IAM和STS服务的模拟。所有状态均存储在内存中,响应采用与AWS兼容的XML格式。
Start
启动
bash
undefinedbash
undefinedAWS only
仅启动AWS模拟
npx emulate --service aws
npx emulate --service aws
Default port (when run alone)
默认端口(单独运行时)
Or programmatically:
```typescript
import { createEmulator } from 'emulate'
const aws = await createEmulator({ service: 'aws', port: 4006 })
// aws.url === 'http://localhost:4006'
或者通过编程方式启动:
```typescript
import { createEmulator } from 'emulate'
const aws = await createEmulator({ service: 'aws', port: 4006 })
// aws.url === 'http://localhost:4006'Auth
认证
Pass tokens as . Scoped permissions use , , , patterns.
Authorization: Bearer <token>s3:*sqs:*iam:*sts:*bash
curl http://localhost:4006/ \
-H "Authorization: Bearer test_token_admin"通过 传递令牌。权限范围采用 、、、 模式。
Authorization: Bearer <token>s3:*sqs:*iam:*sts:*bash
curl http://localhost:4006/ \
-H "Authorization: Bearer test_token_admin"Pointing Your App at the Emulator
将应用指向模拟器
Environment Variable
环境变量
bash
AWS_EMULATOR_URL=http://localhost:4006bash
AWS_EMULATOR_URL=http://localhost:4006AWS SDK v3
AWS SDK v3
typescript
import { S3Client } from '@aws-sdk/client-s3'
const s3 = new S3Client({
endpoint: process.env.AWS_EMULATOR_URL,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
forcePathStyle: true,
})typescript
import { SQSClient } from '@aws-sdk/client-sqs'
const sqs = new SQSClient({
endpoint: `${process.env.AWS_EMULATOR_URL}/sqs`,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
})typescript
import { IAMClient } from '@aws-sdk/client-iam'
const iam = new IAMClient({
endpoint: `${process.env.AWS_EMULATOR_URL}/iam`,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
})typescript
import { S3Client } from '@aws-sdk/client-s3'
const s3 = new S3Client({
endpoint: process.env.AWS_EMULATOR_URL,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
forcePathStyle: true,
})typescript
import { SQSClient } from '@aws-sdk/client-sqs'
const sqs = new SQSClient({
endpoint: `${process.env.AWS_EMULATOR_URL}/sqs`,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
})typescript
import { IAMClient } from '@aws-sdk/client-iam'
const iam = new IAMClient({
endpoint: `${process.env.AWS_EMULATOR_URL}/iam`,
region: 'us-east-1',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
},
})Seed Config
初始配置
yaml
aws:
region: us-east-1
s3:
buckets:
- name: my-app-bucket
- name: my-app-uploads
region: eu-west-1
sqs:
queues:
- name: my-app-events
- name: my-app-dlq
visibility_timeout: 60
- name: my-app-orders.fifo
fifo: true
iam:
users:
- user_name: developer
create_access_key: true
- user_name: readonly-user
roles:
- role_name: lambda-execution-role
description: Role for Lambda function execution
assume_role_policy: '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}'Default seed (always created): S3 bucket , SQS queue , IAM user with access key pair ( / ).
emulate-defaultemulate-default-queueadminAKIAIOSFODNN7EXAMPLEwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYyaml
aws:
region: us-east-1
s3:
buckets:
- name: my-app-bucket
- name: my-app-uploads
region: eu-west-1
sqs:
queues:
- name: my-app-events
- name: my-app-dlq
visibility_timeout: 60
- name: my-app-orders.fifo
fifo: true
iam:
users:
- user_name: developer
create_access_key: true
- user_name: readonly-user
roles:
- role_name: lambda-execution-role
description: Role for Lambda function execution
assume_role_policy: '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}'默认初始资源(自动创建):S3存储桶 、SQS队列 、带有访问密钥对的IAM用户 (密钥对: / )。
emulate-defaultemulate-default-queueadminAKIAIOSFODNN7EXAMPLEwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYAPI Endpoints
API端点
S3
S3
S3 routes use root paths matching the real AWS S3 wire format. Legacy prefixed paths are also supported.
/s3/bash
undefinedS3路由使用与真实AWS S3协议格式匹配的根路径。同时支持传统的 前缀路径。
/s3/bash
undefinedList all buckets
列出所有存储桶
curl http://localhost:4006/
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl http://localhost:4006/
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Create bucket
创建存储桶
curl -X PUT http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -X PUT http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Delete bucket (must be empty)
删除存储桶(必须为空)
curl -X DELETE http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -X DELETE http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Head bucket (check existence, get region)
查询存储桶(检查存在性、获取区域)
curl -I http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -I http://localhost:4006/my-bucket
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
List objects (with prefix, delimiter, pagination)
列出对象(支持前缀、分隔符、分页)
curl "http://localhost:4006/my-bucket?prefix=uploads/&delimiter=/&max-keys=100"
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl "http://localhost:4006/my-bucket?prefix=uploads/&delimiter=/&max-keys=100"
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Put object
上传对象
curl -X PUT http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: text/plain"
-H "x-amz-meta-author: test"
--data-binary "file contents"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: text/plain"
-H "x-amz-meta-author: test"
--data-binary "file contents"
curl -X PUT http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: text/plain"
-H "x-amz-meta-author: test"
--data-binary "file contents"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: text/plain"
-H "x-amz-meta-author: test"
--data-binary "file contents"
Get object
下载对象
curl http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Head object (metadata only)
查询对象元数据
curl -I http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -I http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Delete object
删除对象
curl -X DELETE http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -X DELETE http://localhost:4006/my-bucket/path/to/file.txt
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Copy object
复制对象
curl -X PUT http://localhost:4006/dest-bucket/copy.txt
-H "Authorization: Bearer $TOKEN"
-H "x-amz-copy-source: /source-bucket/original.txt"
-H "Authorization: Bearer $TOKEN"
-H "x-amz-copy-source: /source-bucket/original.txt"
undefinedcurl -X PUT http://localhost:4006/dest-bucket/copy.txt
-H "Authorization: Bearer $TOKEN"
-H "x-amz-copy-source: /source-bucket/original.txt"
-H "Authorization: Bearer $TOKEN"
-H "x-amz-copy-source: /source-bucket/original.txt"
undefinedSQS
SQS
All SQS operations use with as a form-urlencoded parameter.
POST /sqs/Actionbash
undefined所有SQS操作均使用 ,并将 作为表单编码参数传递。
POST /sqs/Actionbash
undefinedCreate queue
创建队列
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue"
Create queue with attributes
创建带属性的队列
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue&Attribute.1.Name=VisibilityTimeout&Attribute.1.Value=30"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue&Attribute.1.Name=VisibilityTimeout&Attribute.1.Value=30"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue&Attribute.1.Name=VisibilityTimeout&Attribute.1.Value=30"
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/x-www-form-urlencoded"
-d "Action=CreateQueue&QueueName=my-queue&Attribute.1.Name=VisibilityTimeout&Attribute.1.Value=30"
List queues
列出队列
List queues with prefix filter
按前缀过滤列出队列
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ListQueues&QueueNamePrefix=my-"
-H "Authorization: Bearer $TOKEN"
-d "Action=ListQueues&QueueNamePrefix=my-"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ListQueues&QueueNamePrefix=my-"
-H "Authorization: Bearer $TOKEN"
-d "Action=ListQueues&QueueNamePrefix=my-"
Get queue URL
获取队列URL
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=my-queue"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=my-queue"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=my-queue"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=my-queue"
Get queue attributes
获取队列属性
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueAttributes&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueAttributes&QueueUrl=<queue_url>"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueAttributes&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueAttributes&QueueUrl=<queue_url>"
Send message
发送消息
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello+World"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello+World"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello+World"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello+World"
Send message with attributes
发送带属性的消息
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello&MessageAttribute.1.Name=type&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=greeting"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello&MessageAttribute.1.Name=type&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=greeting"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello&MessageAttribute.1.Name=type&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=greeting"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=<queue_url>&MessageBody=Hello&MessageAttribute.1.Name=type&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=greeting"
Receive messages
接收消息
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=<queue_url>&MaxNumberOfMessages=5"
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=<queue_url>&MaxNumberOfMessages=5"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=<queue_url>&MaxNumberOfMessages=5"
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=<queue_url>&MaxNumberOfMessages=5"
Delete message
删除消息
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteMessage&QueueUrl=<queue_url>&ReceiptHandle=<receipt_handle>"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteMessage&QueueUrl=<queue_url>&ReceiptHandle=<receipt_handle>"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteMessage&QueueUrl=<queue_url>&ReceiptHandle=<receipt_handle>"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteMessage&QueueUrl=<queue_url>&ReceiptHandle=<receipt_handle>"
Purge queue
清空队列
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=PurgeQueue&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=PurgeQueue&QueueUrl=<queue_url>"
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=PurgeQueue&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=PurgeQueue&QueueUrl=<queue_url>"
Delete queue
删除队列
curl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteQueue&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteQueue&QueueUrl=<queue_url>"
undefinedcurl -X POST http://localhost:4006/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteQueue&QueueUrl=<queue_url>"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteQueue&QueueUrl=<queue_url>"
undefinedIAM
IAM
All IAM operations use with as a form-urlencoded parameter.
POST /iam/Actionbash
undefined所有IAM操作均使用 ,并将 作为表单编码参数传递。
POST /iam/Actionbash
undefinedCreate user
创建用户
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=new-user"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=new-user"
Get user
获取用户信息
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetUser&UserName=new-user"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetUser&UserName=new-user"
List users
列出用户
Delete user
删除用户
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteUser&UserName=new-user"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteUser&UserName=new-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteUser&UserName=new-user"
Create access key
创建访问密钥
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=developer"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=developer"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=developer"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=developer"
List access keys
列出访问密钥
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=ListAccessKeys&UserName=developer"
-H "Authorization: Bearer $TOKEN"
-d "Action=ListAccessKeys&UserName=developer"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=ListAccessKeys&UserName=developer"
-H "Authorization: Bearer $TOKEN"
-d "Action=ListAccessKeys&UserName=developer"
Delete access key
删除访问密钥
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteAccessKey&UserName=developer&AccessKeyId=AKIA..."
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteAccessKey&UserName=developer&AccessKeyId=AKIA..."
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteAccessKey&UserName=developer&AccessKeyId=AKIA..."
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteAccessKey&UserName=developer&AccessKeyId=AKIA..."
Create role
创建角色
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateRole&RoleName=my-role&AssumeRolePolicyDocument={}"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateRole&RoleName=my-role&AssumeRolePolicyDocument={}"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateRole&RoleName=my-role&AssumeRolePolicyDocument={}"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateRole&RoleName=my-role&AssumeRolePolicyDocument={}"
Get role
获取角色信息
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetRole&RoleName=my-role"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetRole&RoleName=my-role"
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetRole&RoleName=my-role"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetRole&RoleName=my-role"
List roles
列出角色
Delete role
删除角色
curl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteRole&RoleName=my-role"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteRole&RoleName=my-role"
undefinedcurl -X POST http://localhost:4006/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteRole&RoleName=my-role"
-H "Authorization: Bearer $TOKEN"
-d "Action=DeleteRole&RoleName=my-role"
undefinedSTS
STS
All STS operations use with as a form-urlencoded parameter.
POST /sts/Actionbash
undefined所有STS操作均使用 ,并将 作为表单编码参数传递。
POST /sts/Actionbash
undefinedGet caller identity
获取调用者身份
curl -X POST http://localhost:4006/sts/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetCallerIdentity"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetCallerIdentity"
curl -X POST http://localhost:4006/sts/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetCallerIdentity"
-H "Authorization: Bearer $TOKEN"
-d "Action=GetCallerIdentity"
Assume role
角色假设
curl -X POST http://localhost:4006/sts/
-H "Authorization: Bearer $TOKEN"
-d "Action=AssumeRole&RoleArn=arn:aws:iam::123456789012:role/my-role&RoleSessionName=my-session"
-H "Authorization: Bearer $TOKEN"
-d "Action=AssumeRole&RoleArn=arn:aws:iam::123456789012:role/my-role&RoleSessionName=my-session"
undefinedcurl -X POST http://localhost:4006/sts/
-H "Authorization: Bearer $TOKEN"
-d "Action=AssumeRole&RoleArn=arn:aws:iam::123456789012:role/my-role&RoleSessionName=my-session"
-H "Authorization: Bearer $TOKEN"
-d "Action=AssumeRole&RoleArn=arn:aws:iam::123456789012:role/my-role&RoleSessionName=my-session"
undefinedInspector
检查器
bash
undefinedbash
undefinedHTML dashboard (shows S3, SQS, IAM state)
HTML仪表板(显示S3、SQS、IAM状态)
Common Patterns
常见使用场景
Upload and Retrieve an Object
上传和获取对象
bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"Create bucket
创建存储桶
curl -X PUT $BASE/my-data
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
curl -X PUT $BASE/my-data
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
Upload file
上传文件
curl -X PUT $BASE/my-data/config.json
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
--data-binary '{"key": "value"}'
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
--data-binary '{"key": "value"}'
curl -X PUT $BASE/my-data/config.json
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
--data-binary '{"key": "value"}'
-H "Authorization: Bearer $TOKEN"
-H "Content-Type: application/json"
--data-binary '{"key": "value"}'
Download file
下载文件
curl $BASE/my-data/config.json
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
undefinedcurl $BASE/my-data/config.json
-H "Authorization: Bearer $TOKEN"
-H "Authorization: Bearer $TOKEN"
undefinedSend and Receive SQS Messages
发送和接收SQS消息
bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"Get queue URL
获取队列URL
QUEUE_URL=$(curl -s -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=emulate-default-queue" | grep -oP '<QueueUrl>\K[^<]+')
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=emulate-default-queue" | grep -oP '<QueueUrl>\K[^<]+')
QUEUE_URL=$(curl -s -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=emulate-default-queue" | grep -oP '<QueueUrl>\K[^<]+')
-H "Authorization: Bearer $TOKEN"
-d "Action=GetQueueUrl&QueueName=emulate-default-queue" | grep -oP '<QueueUrl>\K[^<]+')
Send message
发送消息
curl -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=$QUEUE_URL&MessageBody=Hello+from+emulate"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=$QUEUE_URL&MessageBody=Hello+from+emulate"
curl -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=$QUEUE_URL&MessageBody=Hello+from+emulate"
-H "Authorization: Bearer $TOKEN"
-d "Action=SendMessage&QueueUrl=$QUEUE_URL&MessageBody=Hello+from+emulate"
Receive messages
接收消息
curl -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=$QUEUE_URL&MaxNumberOfMessages=1"
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=$QUEUE_URL&MaxNumberOfMessages=1"
undefinedcurl -X POST $BASE/sqs/
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=$QUEUE_URL&MaxNumberOfMessages=1"
-H "Authorization: Bearer $TOKEN"
-d "Action=ReceiveMessage&QueueUrl=$QUEUE_URL&MaxNumberOfMessages=1"
undefinedCreate IAM User with Access Key
创建带访问密钥的IAM用户
bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"bash
TOKEN="test_token_admin"
BASE="http://localhost:4006"Create user
创建用户
curl -X POST $BASE/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=ci-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=ci-user"
curl -X POST $BASE/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=ci-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateUser&UserName=ci-user"
Generate access key
生成访问密钥
curl -X POST $BASE/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=ci-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=ci-user"
undefinedcurl -X POST $BASE/iam/
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=ci-user"
-H "Authorization: Bearer $TOKEN"
-d "Action=CreateAccessKey&UserName=ci-user"
undefined