latestAll S3存储桶文件已显示,但是当我上传文件时会生成错误。
我有ARN和实例配置文件。
use Aws\Credentials\CredentialProvider;
use Aws\Credentials\InstanceProfileProvider;
use Aws\Credentials\AssumeRoleCredentialProvider;
use Aws\S3\S3Client;
use Aws\Sts\StsClient;
$profile = new InstanceProfileProvider();
$ARN = ""; // MY ARN
$sessionName = "s3-access-example";
$assumeRoleCredentials = new AssumeRoleCredentialProvider([
'client' => new StsClient([
'region' => "ap-east-1",
'version' => "latest",
'credentials' => $profile
]),
'assume_role_params' => [
'RoleArn' => $ARN,
'RoleSessionName' => $sessionName,
],
]);
$provider = CredentialProvider::memoize($assumeRoleCredentials);
$this->s3hd = S3Client::factory([
'credentials' => $provider,
'version' => "latest",
'region' => "ap-east-1"
]);
public function upload($name, $file, $type, $Bucket = false)
{
if (! $Bucket) {
$Bucket = $this->bucket;
}
$result = $this->s3hd->putObject([
'Bucket' => $Bucket,
'Key' => $name,
'SourceFile' => $file,
'ContentType' => $type,
'ACL' => 'public-read'
]);
$this->s3hd->waitUntil('ObjectExists', [
'Bucket' => $Bucket,
'Key' => $name
]);
return $result;
}
消息:在
error file url here
上执行“ PutObject”时出错; AWS HTTP错误:客户端错误:PUTerror file url here
导致400 Bad Request`响应:InvalidToken所提供的令牌格式错误或其他(被截断...)InvalidToken(客户端):所提供的令牌格式错误或以其他方式无效。 -InvalidToken所提供的令牌格式不正确或无效。
答案 0 :(得分:6)
就我而言。我正在尝试通过CLI。
import Control.Concurrent import Data.Maybe import System.IO main = do hSetBuffering stdin NoBuffering future_input <- newEmptyMVar latest_input <- newEmptyMVar forkIO $ ((>>) .) . (>>) <$> putMVar future_input <*> putMVar latest_input <*> (putStrLn . ("pressed key: " ++) . return) =<< getChar wait future_input where wait future_input = do input <- tryTakeMVar future_input if isJust input then main else putStrLn "keep moving" >> threadDelay 1000000 >> wait future_input
.codepoints
内添加了一个随机键值对_pg_dir:
startup_32:
movl $0x10,%eax
mov %ax,%ds
mov %ax,%es
mov %ax,%fs
mov %ax,%gs
lss _stack_start,%esp
call setup_idt
call setup_gdt
movl $0x10,%eax # reload all the segment registers
mov %ax,%ds # after changing gdt. CS was already
mov %ax,%es # reloaded in 'setup_gdt'
mov %ax,%fs
mov %ax,%gs
lss _stack_start,%esp
xorl %eax,%eax
1: incl %eax # check that A20 really IS enabled ~~~
movl %eax,0x000000
cmpl %eax,0x100000
je 1b ~~~
movl %cr0,%eax # check math chip
andl $0x80000011,%eax # Save PG,ET,PE
testl $0x10,%eax
jne 1f # ET is set - 387 is present ~~~
orl $4,%eax # else set emulate bit
1: movl %eax,%cr0 ~~~
jmp after_page_tables
。 IDK为什么。
我删除了Voila奏效了!
答案 1 :(得分:0)
您收到此错误,因为默认情况下未启用香港(ap-east-1)。如果您具有正确的权限,则需要在AWS控制台中启用它,然后重试。
有关如何操作的说明,请参见AWS Docs。