Skip to content

Commit

Permalink
Updated IAM readme & action vertion update
Browse files Browse the repository at this point in the history
  • Loading branch information
akashdeep000 committed Sep 8, 2024
1 parent 1dc0cde commit 876e60a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cdk-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkoutactions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
Expand Down
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,86 @@ The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Deploy the stack on AWS


### Configure IAM

- Go to AWS Identity and Access Management (IAM)
- Create a user and as attatch permissions policie `AWSCloudFormationFullAccess` frow AWS console.
- Create a new policie from JSON
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
"arn:aws:iam::*:role/cdk-*"
]
},
{
"Effect": "Allow",
"Action": [
"cloudformation:*"
],
"Resource": "*"
}
]
}
```
- Save the policie by providing a name (eg: cdk-deploy).
- Create a user and as attatch permissions policie that you just created frow AWS console.
- Select the newly created user and go to the `Security credentials` tab.
- Now on the `Access keys` section, click on the `Create access key` button.
- Now select use case `Command Line Interface (CLI)` and confirm. Click on the next button.
- Click `Create access key` button.
- Now store the `Access key` and `Secret access key`.


### Configure Github Action
- Go to github repo settings.
- On the `Security` section click on `Secrets and variable` and then click on `action`.
- Now click on `New repository secret` and two secret `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY` and the value should be the `Access key` and `Secret access key` you got from AWS console.
- (Optional) Set another secret `AWS_REGION` to specify the deployment region. Default region is `us-east-1`.


### Manually trigger deployment
- You can triger deployment manually by going to `Action` tab on github repo.
- The choosing `CDK Deploy` action and clicking on `Run workflow` button.


### Auto-deploy on code push
If you set up github action then whenever a new code push happen on `master` branch, the deployment will update automatically.


### Lambda api gatway url

You can find the deployment url inside github action log.
Here is a sample output:
```sh
✅ AudioProcessingStack

✨ Deployment time: 42.59s

Outputs:
AudioProcessingStack.gatewayEndpointDA8D204E = https://fivtqcifhd.execute-api.us-east-1.amazonaws.com/prod/
Stack ARN:
arn:aws:cloudformation:us-east-1:***:stack/AudioProcessingStack/b4cff7e0-6df8-11ef-b5ff-0ee5f6741be1

✨ Total time: 47.23s

```
You can see here there is a url `https://fivtqcifhd.execute-api.us-east-1.amazonaws.com/prod/` inside log output. This is the lambda api gatway URL.

You can invoke lambda using this URL.


### Setup custom domain

If you want to add a custom domain you can follow this guide: https://medium.com/geekculture/how-to-add-a-custom-domain-to-lambda-functions-1bc0ae639676


### Configure lambda RAM size and timeout setting

You can change lambda RAM size and timeout setting inside this file: `lib/audio-processing-stack.ts`
Expand Down

0 comments on commit 876e60a

Please sign in to comment.