-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_script
More file actions
31 lines (16 loc) · 2.36 KB
/
setup_script
File metadata and controls
31 lines (16 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
aws iam create-role --role-name lambda-extraction-role --assume-role-policy-document file://role-permissions/trust-policy.json
aws iam put-role-policy --role-name lambda-extraction-role --policy-name example-policy --policy-document file://role-permissions/tweet-extraction-role-permissions.json
zip tweet_extraction.zip tweet_extraction.py
aws lambda create-function --function-name lambda-extraction-function --runtime python3.7 --zip-file fileb://tweet_extraction.zip --handler tweet_extraction.lambda_handler --timeout 120 --memory-size 1024 --environment file://env_variables/env_vars_extract.json --role "arn:aws:iam::account_id:role/lambda-extraction-role"
aws s3api create-bucket --bucket tweet-bucket --region ca-central-1 --create-bucket-configuration LocationConstraint=ca-central-1 --object-ownership BucketOwnerEnforced
aws s3api put-bucket-policy --bucket tweet-bucket --policy file://role-permissions/bucket_permissions.json
aws iam create-role --role-name lambda-transformation-role --assume-role-policy-document file://role-permissions/trust-policy.json
aws iam put-role-policy --role-name lambda-transformation-role --policy-name transformation-policy --policy-document file://role-permissions/tweet-transformation-role-permissions.json
zip tweet_transformation.zip tweet_transformation.py
zip -u tweet_transformation.zip lib/tweet_processing_functions.py
aws lambda create-function --function-name lambda-transformation-function --runtime python3.7 --zip-file fileb://tweet_transformation.zip --handler tweet_transformation.lambda_handler --timeout 120 --memory-size 1024 --role "arn:aws:iam::account_id:role/lambda-transformation-role"
aws rds create-db-instance --db-name tweet_db --db-instance-identifier tweet-data-db --allocated-storage 8 --db-instance-class db.t3.micro --engine postgres --engine-version 14.2 --master-username postgres --master-user-password "gI3zx25w(" --availability-zone ca-central-1d --storage-type gp2 --max-allocated-storage 10
zip tweet_db_load.zip tweet_loader.py
zip -u tweet_db_load.zip lib/loading_util_functions.py
aws lambda create-function --function-name lambda-loading-function --runtime python3.7 --zip-file fileb://tweet_db_load.zip --handler tweet_loader.lambda_handler --timeout 120 --memory-size 1024 --environment file://env_variables/env_vars_load.json --role "arn:aws:iam::account_id:role/lambda-transformation-role"