LoginSignup
1
1

More than 3 years have passed since last update.

Graphql React AWS backet

Last updated at Posted at 2020-02-08

GraphQLを通してreactからAWSに画像保存

参考にしたURL
https://medium.com/@enespalaz/file-upload-with-graphql-9a4927775ef7
正直, これコピペすれば 90% は完成する.
しないといけないのは,AWS のバケットの設定 以下それについて

AWS S3

  • バケットを作る
  • アクセス権限のCORSの設定
  • アクセストークンの発行 //ここまでAWSのアカウント内でやる事
  • config.json の作成
  • https://hack-le.com/s3-everyone-read/

config.json

バケットに対して, バックエンドからアップロードしたりするのに必要

AWS.config.loadFromPath('./config.json');

中身は

{ 
  "accessKeyId": "ABCDEFGDHDHDHJDJHDJDJ",
  "secretAccessKey": "jfoaisdjfaosjfasjfasodjfasfjasdif",
  "region": "ap-northeast-1"
}

config.jsonと"region"は以下参照
config.json: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-json-file.html
region: https://docs.aws.amazon.com/general/latest/gr/rande.html

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1