Speaker: 西谷 圭介, AWS Japan
- The only tunable parameter is MEMORY, but, in fact, it affects all computing resources ex. CPU usage
- Reduce package size
| sudo yum update -y | |
| wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip | |
| unzip aws-sam-cli-linux-x86_64.zip -d sam-installation | |
| sudo ./sam-installation/install --update | |
| sam --version |
| func (d *dependencies) handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { | |
| input := dynamodb.QueryInput{ | |
| ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ | |
| ":v1": { | |
| S: aws.String(request.PathParameters[PathParameter]), | |
| }, | |
| }, | |
| // hard-coded for proof of concept | |
| IndexName: aws.String("SSN-index"), |
| function findProduct(arr) { | |
| // First find the total product of all indeces | |
| let totalProduct = arr[0]; | |
| for (let i = 1; i < arr.length; i++) { | |
| totalProduct *= arr[i]; | |
| } | |
| // Then, return a new array where each index is the | |
| // product of all numbers, except for the current value of that index | |
| // i.e. newArr[0] = arr[1] * arr[2] * arr[3]... arr[length-1]; |