Skip to content

Commit

Permalink
デプロイ時にCSVをキャッシュするバケットを指定しないようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
ot-nemoto committed Jun 6, 2019
1 parent 1a054a4 commit cde2337
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@
### deploy

```sh
BUCKET_NAME=public-holiday-api-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 16 | head -n 1)
echo ${BUCKET_NAME}
#

(cd layer/nodejs; npm install)
sls deploy --bucket-name ${BUCKET_NAME}
sls deploy
```

デプロイパラメータ

|パラメータ|概要|必須(初期値)|
|--|--|--|
|--stage|環境|_false_ (dev)|
|--bucket-name|祝日CSVをキャッシュするバケット名を指定|_true_|
|--bucket-expiration-in-days|キャッシュの有効期間(day)|_false_ (1)|

### API
Expand Down
5 changes: 2 additions & 3 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ provider:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${self:provider.environment.csv_bucket_name}
- !Ref CsvBucketName
- "/*"
environment:
holiday_csv_url: 'https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv'
csv_bucket_name: ${opt:bucket-name}
csv_bucket_name: !Ref CsvBucketName
csv_bucket_expiration_in_days: ${opt:bucket-expiration-in-days, '1'}
TZ: 'Asia/Tokyo'

Expand Down Expand Up @@ -57,7 +57,6 @@ resources:
CsvBucketName:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:provider.environment.csv_bucket_name}
LifecycleConfiguration:
Rules:
- Status: Enabled
Expand Down

0 comments on commit cde2337

Please sign in to comment.