Skip to content

Commit 533ea5d

Browse files
committed
chore: update README
1 parent 2e5af4d commit 533ea5d

1 file changed

Lines changed: 31 additions & 13 deletions

File tree

README.md

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,26 @@ Before the doing the following, make sure your Daemon is running. If using Colim
128128
github-repository-archive-script latest b4a1e32ce51b 12 minutes ago 840MB
129129
```
130130

131-
3. Run the image.
131+
3. Sign in with AWS SSO:
132+
133+
```bash
134+
aws sso login
135+
```
136+
137+
**Note:** See the Developer Onboarding Guide on the "Using AWS SSO for Local Development" page on Confluence to set up service profile selection on your local machine. This is essential as the `~/.aws` directory is mounted to the container, so it can use the SSO session for AWS authentication.
138+
139+
4. Run the image.
132140

133141
```bash
134142
docker run --platform linux/amd64 -p 9000:8080 \
135-
-e AWS_ACCESS_KEY_ID=<access_key_id> \
136-
-e AWS_SECRET_ACCESS_KEY=<secret_access_key> \
137-
-e AWS_DEFAULT_REGION=<region> \
143+
-v ~/.aws:/root/.aws \
144+
-e AWS_PROFILE=github-repository-archive-script \
145+
-e AWS_DEFAULT_REGION=eu-west-2 \
138146
-e AWS_SECRET_NAME=<secret_name> \
139147
-e GITHUB_ORG=<org> \
140148
-e GITHUB_APP_CLIENT_ID=<client_id> \
141-
-e S3_BUCKET_NAME=<bucket_name>\
142-
-e AWS_LAMBDA_FUNCTION_TIMEOUT=300
149+
-e S3_BUCKET_NAME=<bucket_name> \
150+
-e AWS_LAMBDA_FUNCTION_TIMEOUT=300 \
143151
github-repository-archive-script
144152
```
145153

@@ -156,7 +164,7 @@ Before the doing the following, make sure your Daemon is running. If using Colim
156164

157165
Once the container is running, a local endpoint is created at `localhost:9000/2015-03-31/functions/function/invocations`.
158166

159-
4. Check the container is running (Optional).
167+
5. Check the container is running (Optional).
160168

161169
```bash
162170
docker ps
@@ -169,15 +177,15 @@ Before the doing the following, make sure your Daemon is running. If using Colim
169177
ca890d30e24d github-repository-archive-script "/lambda-entrypoint.…" 5 seconds ago Up 4 seconds 0.0.0.0:9000->8080/tcp, :::9000->8080/tcp recursing_bartik
170178
```
171179

172-
5. Post to the endpoint (`localhost:9000/2015-03-31/functions/function/invocations`).
180+
6. Post to the endpoint (`localhost:9000/2015-03-31/functions/function/invocations`).
173181

174182
```bash
175183
curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
176184
```
177185

178186
This will run the Lambda function and, once complete, will return a success message.
179187

180-
6. After testing stop the container.
188+
7. After testing stop the container.
181189

182190
```bash
183191
docker stop <container_id>
@@ -198,11 +206,21 @@ To run the Lambda function outside of a container, we need to execute the `handl
198206
199207
**Please Note:** If uncommenting the above in `main.py`, make sure you re-comment the code _before_ pushing back to GitHub.
200208
201-
2. Export the required environment variables:
209+
2. Sign in with AWS SSO, and export the correct profile for this service:
210+
211+
```bash
212+
aws sso login
213+
214+
export AWS_PROFILE=github-repository-archive-script
215+
```
216+
217+
This allows you to assume the AWS IAM role for the service, enabling the most secure development experience. This also means you will have limited permissions until you exit out of the profile.
218+
219+
**Note:** See the Developer Onboarding Guide on the "Using AWS SSO for Local Development" page on Confluence to set up service profile selection on your local machine.
220+
221+
3. Export the required environment variables:
202222
203223
```bash
204-
export AWS_ACCESS_KEY_ID=<access_key_id>
205-
export AWS_SECRET_ACCESS_KEY=<secret_access_key>
206224
export AWS_DEFAULT_REGION=eu-west-2
207225
export AWS_SECRET_NAME=<secret_name>
208226
export S3_BUCKET_NAME=<bucket_name>
@@ -212,7 +230,7 @@ To run the Lambda function outside of a container, we need to execute the `handl
212230
213231
An explanation of each variable is available within the [containerised instructions](#containerised-recommended).
214232
215-
3. Run the script.
233+
4. Run the script.
216234
217235
```bash
218236
python3 src/main.py

0 commit comments

Comments
 (0)