2017-04-17 82 views
1

“< domain>”在以下示例HTTP POST中引用了什么?“<domain>”在以下示例HTTP POST中引用了什么?

当然,主机不应该字面上是“kinesis。< region>。< domain>”,但文章没有提及区域和域是什么具体。

请为实际的“主机:”行提供几个字面示例。

 

    POST/HTTP/1.1 
    Host: kinesis.<region>.<domain> 
    Content-Length: 
    User-Agent: 
    Content-Type: application/x-amz-json-1.1 
    Authorization: 
    Connection: Keep-Alive 
    X-Amz-Date: 
    X-Amz-Target: Kinesis_20131202.PutRecord 
    { 
     "StreamName": "exampleStreamName", 
     "Data": "XzxkYXRhPl8x", 
     "PartitionKey": "partitionKey" 
    } 

链接到整个文章是在这里:http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html#API_PutRecord_Examples

回答

0

你下面的例子是被张贴实际的HTTP请求。 和domain simplyamazonaws.com,而区域可能是us-west-1us-west-2等等等根据您正在使用的区域。

因此,端点或他们所称的"host"看起来像kinesis.us-west-2.amazonaws.com

AWS Regions and Endpoints

现在

阅读教育部,把室壁运动流中的事件,我使用CLI这是很酷,方便,

aws kinesis put-record --stream-name GregorSamsa --partition-key gregor-samsa --data "whatever" --region us-west-2 --profile aws-credentials 
{ 
    "ShardId": "shardId-000000000000", 
    "SequenceNumber": "49572068906441151838856607979148753861106406028656771074" 
} 

而且也看到实际的HTTP请求时,它的帖子运行它在--verbose模式,

$ aws kinesis put-record --stream-name GregorSamsa --partition-key gregor-samsa --data "whatever" --region us-west-2 --profile aws-credentials --debug 
2017-04-16 19:48:34,993 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.11.66 Python/2.7.10 Darwin/15.6.0 botocore/1.5.29 
2017-04-16 19:48:34,994 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['kinesis', 'put-record', '--stream-name', 'a0135-GregorSamsa', '--partition-key', 'gregor-samsa', '--data', 'whatever', '--region', 'us-west-2', '--profile', 'aws-credentials', '--debug'] 
2017-04-16 19:48:34,994 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x103039938> 
2017-04-16 19:48:34,994 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x102d9ac08> 
2017-04-16 19:48:34,994 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set. 
2017-04-16 19:48:34,994 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/as18/Library/Python/2.7/lib/python/site-packages/botocore/data/kinesis/2013-12-02/service-2.json 
2017-04-16 19:48:34,998 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.kinesis: calling handler <function register_retries_for_service at 0x1029992a8> 
2017-04-16 19:48:34,998 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: kinesis 
2017-04-16 19:48:34,999 - MainThread - botocore.hooks - DEBUG - Event building-command-table.kinesis: calling handler <function add_waiters at 0x103043a28> 
2017-04-16 19:48:35,002 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/as18/Library/Python/2.7/lib/python/site-packages/botocore/data/kinesis/2013-12-02/waiters-2.json 
2017-04-16 19:48:35,003 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'stream-name', <awscli.arguments.CLIArgument object at 0x1033c7110>), (u'data', <awscli.arguments.CLIArgument object at 0x1033c7150>), (u'partition-key', <awscli.arguments.CLIArgument object at 0x1033c7190>), (u'explicit-hash-key', <awscli.arguments.CLIArgument object at 0x1033c71d0>), (u'sequence-number-for-ordering', <awscli.arguments.CLIArgument object at 0x1033c7210>)]) 
2017-04-16 19:48:35,003 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.kinesis.put-record: calling handler <function add_streaming_output_arg at 0x103039b90> 
2017-04-16 19:48:35,003 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.kinesis.put-record: calling handler <function add_cli_input_json at 0x102d9fa28> 
2017-04-16 19:48:35,003 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.kinesis.put-record: calling handler <function unify_paging_params at 0x102fc52a8> 
2017-04-16 19:48:35,005 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/as18/Library/Python/2.7/lib/python/site-packages/botocore/data/kinesis/2013-12-02/paginators-1.json 
2017-04-16 19:48:35,005 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.kinesis.put-record: calling handler <function add_generate_skeleton at 0x102fb5668> 
2017-04-16 19:48:35,006 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.kinesis.put-record: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x1033c7290>> 
2017-04-16 19:48:35,006 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.kinesis.put-record: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1033bae10>> 
2017-04-16 19:48:35,006 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.stream-name: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.kinesis.put-record: calling handler <awscli.argprocess.ParamShorthandParser object at 0x103049110> 
2017-04-16 19:48:35,007 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'a0135-GregorSamsa' for parameter "stream_name": u'a0135-GregorSamsa' 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.data: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.kinesis.put-record: calling handler <awscli.argprocess.ParamShorthandParser object at 0x103049110> 
2017-04-16 19:48:35,007 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'whatever' for parameter "data": u'whatever' 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.partition-key: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.kinesis.put-record: calling handler <awscli.argprocess.ParamShorthandParser object at 0x103049110> 
2017-04-16 19:48:35,007 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'gregor-samsa' for parameter "partition_key": u'gregor-samsa' 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.explicit-hash-key: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.sequence-number-for-ordering: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.cli-input-json: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.kinesis.put-record.generate-cli-skeleton: calling handler <function uri_param at 0x102c37938> 
2017-04-16 19:48:35,007 - MainThread - botocore.hooks - DEBUG - Event calling-command.kinesis.put-record: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1033bae10>> 
2017-04-16 19:48:35,008 - MainThread - botocore.hooks - DEBUG - Event calling-command.kinesis.put-record: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x1033c7290>> 
2017-04-16 19:48:35,008 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role 
2017-04-16 19:48:35,008 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file 
2017-04-16 19:48:35,008 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials 
2017-04-16 19:48:35,008 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /Users/as18/Library/Python/2.7/lib/python/site-packages/botocore/data/endpoints.json 
2017-04-16 19:48:35,018 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: kinesis 
2017-04-16 19:48:35,019 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.kinesis: calling handler <function add_generate_presigned_url at 0x10295cc80> 
2017-04-16 19:48:35,019 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None 
2017-04-16 19:48:35,022 - MainThread - botocore.endpoint - DEBUG - Setting kinesis timeout as (60, 60) 
2017-04-16 19:48:35,022 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.kinesis.PutRecord: calling handler <function generate_idempotent_uuid at 0x102995c80> 
2017-04-16 19:48:35,023 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=PutRecord) (verify_ssl=True) with params: {'body': '{"PartitionKey": "gregor-samsa", "Data": "d2hhdGV2ZXI=", "StreamName": "a0135-GregorSamsa"}', 'url': u'https://kinesis.us-west-2.amazonaws.com/', 'headers': {'User-Agent': 'aws-cli/1.11.66 Python/2.7.10 Darwin/15.6.0 botocore/1.5.29', 'Content-Type': u'application/x-amz-json-1.1', 'X-Amz-Target': u'Kinesis_20131202.PutRecord'}, 'context': {'client_region': u'us-west-2', 'has_streaming_input': False, 'client_config': <botocore.config.Config object at 0x103530690>}, 'query_string': '', 'url_path': '/', 'method': u'POST'} 
2017-04-16 19:48:35,023 - MainThread - botocore.hooks - DEBUG - Event request-created.kinesis.PutRecord: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x103530650>> 
2017-04-16 19:48:35,023 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth. 
2017-04-16 19:48:35,023 - MainThread - botocore.auth - DEBUG - CanonicalRequest: 
POST 
/

content-type:application/x-amz-json-1.1 
host:kinesis.us-west-2.amazonaws.com 
x-amz-date:20170417T024835Z 
x-amz-security-token:"FQoDYXdzECQaDHw6n1Hfn5egvEAxeyK1AgClSVMQWgZr9dr0bRI4Xo3ocilODVE0SEymvty4OP0lSKu19DiVbpg4t+p4PAaWVQ6fQGyu9DGi5JkQZBsyW5JlZDFE8nOmpqZOddhrrc1KRWTstqtTtwNiLL18FMxQ43S5wdveS1YMsgYhEcuQtwknbN4sdYwNrDETDF4Ies/DGQqVhM0m9YX2Zu6nYZiuA8RLqf0RLpbPHDEKpLFE/uXPo4qIaGez3IZWU6Spu59Wt52Z7yQMoSlV4vJVrCoYpM7x9Eai0zZkynGD1FSW5i3knF7V0Y3dBdRBDFDSF3UXCF45+3yRFjJSvd+Se323dTzKXoZPc9AgvNl1gBLGYMY3pY5v5bGjPK4OkVF+vQkStWKQpodNe1lTGgqkniZlpNqLefiUuhtUVSTQPVBuTV/N4VA6MiiT0dDHBQ==" 
x-amz-target:Kinesis_20131202.PutRecord 

content-type;host;x-amz-date;x-amz-security-token;x-amz-target 
337fb90b0529a5bc7eb6274475923e82c948363ff492f56071c948b24bf7181a 
2017-04-16 19:48:35,023 - MainThread - botocore.auth - DEBUG - StringToSign: 
AWS4-HMAC-SHA256 
20170417T024835Z 
20170417/us-west-2/kinesis/aws4_request 
da8e3f33931941015cd88df2ef325da5488ff70fb93b55eaa46349cea9f547e0 
2017-04-16 19:48:35,023 - MainThread - botocore.auth - DEBUG - Signature: 
d7d071a403c97b018ba63477e91fe3799ae15ba895a6b216fa898ae2b19d3bdc 
2017-04-16 19:48:35,025 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [POST]> 
2017-04-16 19:48:35,026 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): kinesis.us-west-2.amazonaws.com 
2017-04-16 19:48:35,566 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST/HTTP/1.1" 200 110 
2017-04-16 19:48:35,567 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-requestid': 'e56a1871-3e84-a549-b404-3732842305a5', 'content-length': '110', 'x-amz-id-2': 'wartiXlESG6jqLxOILWnDGjdKF6J4Q/EXwd05kGMYbWE3nDvmjJ+U+VPahhPPrn4nw7kYKoV1MC47y4NiGTJW/UV/kuGa5wh', 'server': 'Apache-Coyote/1.1', 'date': 'Mon, 17 Apr 2017 02:48:34 GMT', 'content-type': 'application/x-amz-json-1.1'} 
2017-04-16 19:48:35,567 - MainThread - botocore.parsers - DEBUG - Response body: 
{"SequenceNumber":"49572068906441151838856607983585511619092105132872040450","ShardId":"shardId-000000000000"} 
2017-04-16 19:48:35,567 - MainThread - botocore.hooks - DEBUG - Event needs-retry.kinesis.PutRecord: calling handler <botocore.retryhandler.RetryHandler object at 0x103315510> 
2017-04-16 19:48:35,568 - MainThread - botocore.retryhandler - DEBUG - No retry needed. 
2017-04-16 19:48:35,568 - MainThread - awscli.formatter - DEBUG - RequestId: e56a1871-3e84-a549-b404-3732842305a5 
{ 
    "ShardId": "shardId-000000000000", 
    "SequenceNumber": "49572068906441151838856607983585511619092105132872040450" 
} 

AWS profile(--profile)用于认证到室壁运动流,放在~/.aws/credentials文件

示例,

[aws-credentials]                                        
aws_access_key_id=ASIAI7QTMT4VDPQBZVSS                 
aws_secret_access_key=bsYA6yZGBIRTiqfJP6V2YPOl0qTvS/bLmFdZd6bG           
aws_session_token="FQoDYXdzECQaDCBVBForaMuopUR+LyK1AhN4L2BZ4GCQ8prX/gtWN7vZI6pa+Ltv3xetSnDXxPCLeCAXTj12ENX/VldWfzvGPQ8NbpP2GGHPUHVNNU5bJyE6umLy/nBEDV7jJiSW2eBOD6X0d33GfJ2G893iIwFHu6IfrXiSwoQs8BuulG/ygOYZa6GWbYxagwy69HFMAtWTnGKs/L6dRikgpU6KoyVkBwfnEN0jKWcIQKd1VcED1+iIcbbDROl9P1NcxQIBnJDdV3qYk1+jLTu/hPoB8kwcKZOj/bZAnhGto3nPMb8vkQ/uLgZ5GA7e/JBhsnMLIyqrUVdd0txokHylVCajHPo//vYDaO7/NrkHeaizt2zCGkPNqm5XvCVrQvp2cJMFV850A2b7Ilq3N/KHr0iiVy5m4CHkC5BS9eqzAq8WuR3/D/mOy9slrCiH2tDHBQ==" 
aws_security_token="FQoDYXdzECQaDCBVBForaMuopUR+LyK1AhN4L2BZ4GCQ8prX/gtWN7vZI6pa+Ltv3xetSnDXxPCLeCAXTj12ENX/VldWfzvGPQ8NbpP2GGHPKHVNNU5bJyE6umLy/nBEDV7jJiSW2eBOD6X0d33GfJ2G893iIwFHu6IfrXiSwoQ8pBuulG/ygOYZa6GWbYxagwy69HFMAtWTnGKs/L6dRikgpU6KoyVkBwfnEN0jKWcIQKd1VcED1+iIcbbDROl9P1NcxQIBnJDdV3qYk1+jLTu/hPoB8kwcKZOj/bZAnhGto3nPMb8vkQ/uGpZ5GA7e/JBhsnMLIyqrUVdd0txokHylVCajHPo//vYDaO7/NrkHeaizt2zCGkPNqm5XvCVrQvp2cJMFV850A2b7Ilq3N/KHr0iiVy5m4CHkC5BS9eqzAq8WuR3/D/mOy9slrCiH2tDHBQ==" 
相关问题