This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider "google" { | |
| credentials = "${file("${var.credentials}")}" | |
| project = "${var.project}" | |
| region = "${var.region}" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zip -r deployment.zip handler.rb | |
| aws lambda update-function-code --function-name ScanMovies --zip-file fileb://./deployment.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "1", | |
| "Effect": "Allow", | |
| "Action": "dynamodb:Scan", | |
| "Resource": [ | |
| "arn:aws:dynamodb:eu-west-3:*:table/movies", | |
| "arn:aws:dynamodb:eu-west-3:*:table/movies/index/*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'aws-sdk' | |
| require 'json' | |
| def lambda_handler(event:, context:) | |
| dynamodb = Aws::DynamoDB::Client.new(region: ENV['AWS_REGION']) | |
| resp = dynamodb.scan({ | |
| table_name: ENV['TABLE_NAME'], | |
| }) | |
| { statusCode: 200, body: JSON.generate(resp.items) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.handler = (event, context, callback) => { | |
| const request = event.Records[0].cf.request | |
| const headers = request.headers | |
| if(request.uri == '/') { | |
| if (typeof headers['accept-language'] !== 'undefined') { | |
| const supportedLanguages = headers['accept-language'][0].value | |
| console.log('Supported languages:', supportedLanguages) | |
| if(supportedLanguages.startsWith('en')){ | |
| callback(null, redirect('/en/')) | |
| } else if(supportedLanguages.startsWith('fr')){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws cognito-idp admin-initiate-auth -region AWS_REGION -cli-input-json file://input.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AuthenticationResult": { | |
| "ExpiresIn": 3600, | |
| "IdToken": "ID_TOKEN", | |
| "RefreshToken": "REFRESH_TOKEN", | |
| "TokenType": "Bearer", | |
| "AccessToken": "ACCESS_TOKEN" | |
| }, | |
| "ChallengeParameters": {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "UserPoolId": "USER_POOL", | |
| "ClientId": "CLIENT_ID", | |
| "AuthFlow": "ADMIN_NO_SRP_AUTH", | |
| "AuthParameters": { | |
| "USERNAME": "USERNAME", | |
| "PASSWORD": "PASSWORD" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create a user | |
| aws cognito-idp sign-up -region AWS_REGION -client-id CLIENT_ID \ | |
| -username USERNAME -password PASSWORD -user-attributes Name=email,Value=EMAIL | |
| # Confirm sign up | |
| aws cognito-idp admin-confirm-sign-up -region AWS_REGION -user-pool-id USER_POOL \ | |
| -username USERNAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012–10–17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "dynamodb:PutItem", | |
| "dynamodb:GetItem", | |
| "dynamodb:DeleteItem", |