概要 ユーザーがアップロードした画像データをS3に保存するケースにおいて Serverless Frameworkを使用して、AWS API Gateway 経由しLambdaで処理をするときに、 Cognitoで認証したユーザーのIAMをSTSを使用してS3にPUTするときの説明です。 今日は上記の図の四角で囲った部分の話をします。 serverless.yml provider: name: aws runtime: nodejs6.10 stage: dev region: us-west-2 # iamRoleStatements: # - Effect: "Allow" # Action: # - "s3:PutObject" # Resource: # - "arn:aws:s3:::yukashita-image-uploads/original-files/${self:p
社内向けのサーバーレスなサービスが想定で、API GatewayでセキュアなAPIを作ることを考える。 そこでCognito UserPoolを使った場合のメモ Severless Framework auth: handler: auth.default timeout : 5 memorySize : 256 secureCheck: handler: handler.secureCheck # 動かすlambda関数名 timeout : 5 memorySize : 128 events: - http: method: get path: secureCheck cors : true authorizer: auth #authorizer: xxx:xxx:Lambda-Name も可能 response: headers: Content-Type: "'applicati
Using Status Codes To return a given status code you simply need to add square brackets with the status code of your choice to your returned message like this: [401] You are not authorized to access this resource!. Here's an example which shows you how you can raise a 404 HTTP status from within your lambda function. module.exports.hello = (event, context, callback) => { callback(new Error('[404]
公式ドキュメントに書いてあるままなのですがドハマリしたのでメモ https://serverless.com/framework/docs/providers/aws/events/apigateway#enabling-cors sls create --template aws-node でプロジェクトを作って… serverless.yml で cors: true を設定する functions: hello: handler: handler.hello events: - http: path: user/create method: get cors: true exports.handler = function(event, context, callback) { const response = { statusCode: 200, headers: { "Acces
As Lin Clark emphasizes in her article about Rust and WebAssembly: the goal of WebAssembly is not to replace JavaScript, but to be an awesome tool to use with JavaScript. Lots of amazing work has been done to simplify crossing the language boundary between JavaScript and WebAssembly, and you can read all about that in Alex Crichton’s post on wasm-bindgen. This post focuses on a different type of J
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く