more optimizations to reduce lambda size

This commit is contained in:
EC2 Default User 2018-05-24 06:50:24 +00:00
parent 1ba5b74eeb
commit bfbb2e27a8
2 changed files with 4 additions and 10 deletions

View File

@ -1,7 +1,6 @@
import os import os
import boto3 import boto3
from boto.dynamodb2.exceptions import ResourceInUseException
db = boto3.resource('dynamodb') db = boto3.resource('dynamodb')
@ -47,7 +46,7 @@ def get_trade_table():
'WriteCapacityUnits': 1 'WriteCapacityUnits': 1
} }
) )
except ResourceInUseException as e: except Exception as e:
print("table already exist {}".format(e)) print("table already exist {}".format(e))
return db.Table(table_name) return db.Table(table_name)
@ -93,7 +92,7 @@ def get_strategy_table():
'WriteCapacityUnits': 1 'WriteCapacityUnits': 1
} }
) )
except ResourceInUseException as e: except Exception as e:
print("table already exist {}".format(e)) print("table already exist {}".format(e))
return db.Table(table_name) return db.Table(table_name)

View File

@ -18,13 +18,8 @@ provider:
iamRoleStatements: iamRoleStatements:
- Effect: Allow - Effect: Allow
Action: Action:
- dynamodb:Query - dynamodb:*
- dynamodb:Scan Resource: "*"
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/*"
- Effect: Allow - Effect: Allow
Action: Action:
- SNS:* - SNS:*