File tree Expand file tree Collapse file tree 3 files changed +35
-24
lines changed Expand file tree Collapse file tree 3 files changed +35
-24
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ More info here <https://developer.twitter.com/en/docs/basics/apps/overview>.
88
99Note the Consumer API keys and Access token & access token secret.
1010
11+ You can set these as environment variables, should you wish to create the SSM parameters using the AWS CLI:
12+
1113``` sh
12- CONSUMER_KEY=...
13- CONSUMER_SECRET=...
14- ACCESS_TOKEN=...
15- ACCESS_TOKEN_SECRET=...
14+ CONSUMER_KEY=5YAAipG8DLKjhdkjfhfQMZyuYhJ
15+ CONSUMER_SECRET=qi3YF6hzdflkjLKJFZgJ6J3WwmEktMfX0IwPQMas
16+ ACCESS_TOKEN=110809243434444423-pHHgCWvWOhc1KJHSLKJHFCAyrDOq0cR
17+ ACCESS_TOKEN_SECRET=QXesCU9LKJHFLKJHKFF9FFVOjymg9UIDvRa58ySaQjd7357
1618```
1719
1820## Create SSM Parameters
@@ -44,12 +46,20 @@ Grant access to your S3 bucket:
4446{
4547 "Version" : " 2012-10-17" ,
4648 "Statement" : [{
47- "Effect" : " Allow" ,
48- "Action" : [
49- " s3:GetObject"
50- ],
51- "Resource" : " arn:aws:s3:::123456789012-twitterbot/*"
52- }]
49+ "Effect" : " Allow" ,
50+ "Action" : [
51+ " s3:GetObject"
52+ ],
53+ "Resource" : " arn:aws:s3:::123456789012-twitterbot/*"
54+ },
55+ {
56+ "Effect" : " Allow" ,
57+ "Action" : [
58+ " ssm:GetParameter"
59+ ],
60+ "Resource" : " arn:aws:ssm:us-east-2:123456789012:parameter/TwitterBot*"
61+ }
62+ ]
5363}
5464```
5565
@@ -67,17 +77,10 @@ pip install -r requirements.txt --no-deps -t package
6777cd package
6878zip -r9 ../package.zip .
6979cd ..
70- zip -g package.zip lambda_handler .py
80+ zip -g package.zip lambda_function .py
7181rm -rf package/*
7282```
7383
74- <!--
75- ## Update Lambda funcion
76-
77- ```sh
78- aws lambda update-function-code --function-name TwitterBot --zip-file fileb://package.zip
79- ``` -->
80-
8184## Create Lambda function
8285
8386``` sh
Original file line number Diff line number Diff line change 11{
22 "Version" : " 2012-10-17" ,
33 "Statement" : [{
4- "Effect" : " Allow" ,
5- "Action" : [
6- " s3:GetObject"
7- ],
8- "Resource" : " arn:aws:s3:::{bucket-name}/*"
9- }]
4+ "Effect" : " Allow" ,
5+ "Action" : [
6+ " s3:GetObject"
7+ ],
8+ "Resource" : " arn:aws:s3:::123456789012-twitterbot/*"
9+ },
10+ {
11+ "Effect" : " Allow" ,
12+ "Action" : [
13+ " ssm:GetParameter"
14+ ],
15+ "Resource" : " arn:aws:ssm:us-east-2:123456789012:parameter/TwitterBot*"
16+ }
17+ ]
1018}
File renamed without changes.
You can’t perform that action at this time.
0 commit comments