Skip to content

Commit 90ae9a1

Browse files
Update hw5-25.md
1 parent 503a607 commit 90ae9a1

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

docs/assignments/hw5-25.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ You are going to create a [REST API](https://www.redhat.com/en/topics/api/what-i
7878
This API will expose the `calculate` function.
7979

8080
Start from [this tutorial](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway-tutorial.html#services-apigateway-tutorial-api) or the AWS docs above to create a REST API that exposes `calculate`.
81+
82+
After setting up API Gateway, locate the API call logic in your frontend code (where it currently calls localhost). Replace the localhost URL with the API Gateway endpoint URL.
83+
8184
Then, coordinate with your team to make sure that invocations of `calculate` call the calculator's backend lambda code.
8285

8386
### 3. Use S3 and Amplify to host your frontend code
@@ -89,22 +92,51 @@ You'll be using it to host your calculator frontend code. With this you will be
8992

9093
Amplify integrates with [Amazon S3](https://docs.aws.amazon.com/amplify/latest/userguide/hosting.html) to store and serve static assets like HTML, CSS, and JavaScript files. It provides an automated deployment pipeline that syncs with your GitHub repository and updates the frontend whenever changes are pushed to the main branch.
9194

92-
To complete this part of the assignment, refer to the following AWS documentation:
95+
Your task is to set up Amplify to host the frontend of your application. To complete this part of the assignment, refer to the following AWS documentation:
9396
- [Getting started with Amplify hosting with S3](https://docs.aws.amazon.com/amplify/latest/userguide/deploy-website-from-s3.html)
94-
- [Using Amplify With Github](https://docs.aws.amazon.com/amplify/latest/userguide/setting-up-GitHub-access.html)
95-
96-
Your task is to set up Amplify to host the frontend of your application, ensuring that updates are deployed automatically on each commit to the main branch.
9797

9898
### 4. Use Github actions to automatically deploy on each push to main
9999

100-
Finally, you will use a Github action to automatically:
101-
1. Deploy your packaged backend lambda code.
102-
2. Deploy your frontend code to S3.
103-
3. Deploy the updates made on S3 to Amplify endpoint.
100+
After getting hands on experience with each service , you will use a Github action to ensure that updates are deployed automatically on each commit to the main branch
101+
102+
The CD pipeline will perform the following tasks:
103+
1. Deploy the packaged backend Lambda code.
104+
2. Deploy the frontend code with the updated API endpoints to S3.
105+
3. Trigger AWS Amplify to redeploy the frontend from S3.
104106

105107
In order to do this, you will need to allow Github to authenticate to AWS.
106108
Follow the [Github documentation](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) to safely use your AWS secrets in CD. [This AWS blog post](https://aws.amazon.com/blogs/compute/using-github-actions-to-deploy-serverless-applications/) describes some (basic) best practices for generating and handling AWS authentication secrets in CI; navigate to the "Configuring AWS credentials in GitHub" section of the tutorial.
107109

110+
Next, you will create one or more .yml files under the .github/workflows/ directory in your repository.
111+
For example:
112+
.github/workflows/deploy-aws-s3.yml (for AWS S3 deployment)
113+
.github/workflows/deploy-aws-lambda.yml (for AWS lambda deployment)
114+
115+
Sample GitHub Actions Workflow
116+
```yaml
117+
name:
118+
119+
# Specify when this workflow should be triggered
120+
on:
121+
push:
122+
branches:
123+
124+
125+
jobs:
126+
deploy:
127+
# Specify the environment for this job (e.g., ubuntu-latest)
128+
runs-on:
129+
130+
steps:
131+
- name: # Short title describing what this step does (e.g., "Checkout Repository", "Build Frontend")
132+
run: # The command to execute (e.g., "npm install", "aws s3 sync")
133+
uses: # GitHub Action to use (e.g., "actions/checkout@v2", "aws-actions/configure-aws-credentials@v2")
134+
env: # Environment variables for this step (e.g., AWS keys, API URLs)
135+
136+
- name:
137+
...
138+
```
139+
108140
#### Deploying backend code
109141
110142
You should create a [Github workflow](https://docs.github.com/en/actions/writing-workflows) that takes the follow steps:
@@ -113,6 +145,7 @@ You should create a [Github workflow](https://docs.github.com/en/actions/writing
113145
- Uses the AWS CLI to update the lambda code (giving the CLI access to your authentication secret and AWS region through the environment).
114146
115147
#### Deploying frontend code
148+
- [Using Amplify With Github](https://docs.aws.amazon.com/amplify/latest/userguide/setting-up-GitHub-access.html)
116149
117150
118151

0 commit comments

Comments
 (0)