tynmarket / prime-crawler

0 stars 0 forks source link

memo #2

Open tynmarket opened 4 years ago

tynmarket commented 4 years ago

SAM

lambda

dynamodb

dynamodb-admin

自動化ルール

go-twitter

Example Request

写真加工.com

tynmarket commented 4 years ago
docker run -d --name dynamodb -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb

aws dynamodb create-table \
  --endpoint-url http://localhost:8000 \
  --table-name prime_books \
  --attribute-definitions \
    AttributeName=asin,AttributeType=S \
    AttributeName=year_month,AttributeType=S \
    AttributeName=created_at,AttributeType=S \
  --key-schema AttributeName=asin,KeyType=HASH \
  --global-secondary-indexes "[{ \
    \"IndexName\": \"year_month-index\", \
    \"KeySchema\":[ \
      { \
        \"AttributeName\":\"year_month\", \
        \"KeyType\":\"HASH\" \
      }, \
      { \
        \"AttributeName\":\"created_at\", \
        \"KeyType\":\"RANGE\" \
      } \
    ], \
    \"Projection\":{\"ProjectionType\":\"KEYS_ONLY\"}} \
  ]" \
  --billing-mode PAY_PER_REQUEST

DYNAMO_ENDPOINT=http://localhost:8000 dynamodb-admin

DYNAMO_DB_LOCAL=true go run main.go
tynmarket commented 4 years ago
sam init --runtime go1.x --name go-test
sam build
sam deploy --guided

sam build && sam deploy \
ParameterKey=TwitterConsumerKey,ParameterValue=$TWITTER_CONSUMER_KEY \
ParameterKey=TwitterConsumerSecret,ParameterValue=$TWITTER_CONSUMER_SECRET \
ParameterKey=TwitterAccessToken,ParameterValue=$TWITTER_ACCESS_TOKEN \
ParameterKey=TwitterAccessTokenSecret,ParameterValue=$TWITTER_ACCESS_TOKEN_SECRET