File tree 6 files changed +19
-7
lines changed 6 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ usage: ## Show usage for this Makefile
5
5
deploy : # # Deploy the application to LocalStack
6
6
bin/deploy.sh
7
7
8
+ deploy-cdk : # # Deploy the application to LocalStack via CDK
9
+ AWS_CMD=awslocal CDK_CMD=cdklocal bin/deploy_cdk.sh
10
+
8
11
web : # # Open the Web app in the browser (after the app is deployed)
9
12
DOMAIN_NAME=$$(awslocal cloudfront list-distributions | jq -r '.DistributionList.Items[0].DomainName' ) ; \
10
13
echo " CloudFront URL: https://$$ DOMAIN_NAME" ; \
Original file line number Diff line number Diff line change @@ -246,8 +246,8 @@ log "API endpoints set up successfully."
246
246
log " Deploying API..."
247
247
awslocal apigateway create-deployment \
248
248
--rest-api-id $API_ID \
249
- --stage-name test > /dev/null
250
- API_ENDPOINT=" http://localhost:4566/_aws/execute-api/$API_ID /test "
249
+ --stage-name prod > /dev/null
250
+ API_ENDPOINT=" http://localhost:4566/_aws/execute-api/$API_ID /prod "
251
251
log " API deployed. Endpoint: $API_ENDPOINT "
252
252
253
253
# SQS DLQ -> EventBridge Pipes -> SNS
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ if [ ! -d frontend/build ]; then
15
15
)
16
16
fi
17
17
18
+ # bootstrap the stack
19
+ (cd cdk
20
+ npm run ${CDK_CMD} bootstrap
21
+ )
22
+
18
23
# deploy bulk of the application
19
24
(cd cdk
20
25
npm run ${CDK_CMD} -- deploy --require-approval never QuizAppStack
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ if [ -z "$API_ID" ]; then
25
25
exit 1
26
26
fi
27
27
28
- API_ENDPOINT=" $AWS_ENDPOINT_URL /_aws/execute-api/$API_ID /test "
28
+ API_ENDPOINT=" $AWS_ENDPOINT_URL /_aws/execute-api/$API_ID /prod "
29
29
30
30
create_quiz () {
31
31
local quiz_data=$1
Original file line number Diff line number Diff line change 5
5
import json
6
6
import time
7
7
8
+ API_NAME = 'QuizAPI'
9
+ STAGE_NAME = "prod"
10
+
11
+
8
12
@pytest .fixture (scope = 'module' )
9
13
def api_endpoint ():
10
14
apigateway_client = boto3 .client ('apigateway' , endpoint_url = 'http://localhost:4566' )
11
15
lambda_client = boto3 .client ('lambda' , endpoint_url = 'http://localhost:4566' )
12
16
13
- API_NAME = 'QuizAPI'
14
17
response = apigateway_client .get_rest_apis ()
15
18
api_list = response .get ('items' , [])
16
19
api = next ((item for item in api_list if item ['name' ] == API_NAME ), None )
@@ -19,7 +22,7 @@ def api_endpoint():
19
22
raise Exception (f"API { API_NAME } not found." )
20
23
21
24
API_ID = api ['id' ]
22
- API_ENDPOINT = f"http://localhost:4566/_aws/execute-api/{ API_ID } /test "
25
+ API_ENDPOINT = f"http://localhost:4566/_aws/execute-api/{ API_ID } /{ STAGE_NAME } "
23
26
24
27
print (f"API Endpoint: { API_ENDPOINT } " )
25
28
Original file line number Diff line number Diff line change 9
9
from localstack .sdk .chaos .managers import fault_configuration
10
10
11
11
LOCALSTACK_ENDPOINT = "http://localhost.localstack.cloud:4566"
12
- API_NAME = 'QuizAPI'
12
+ API_NAME = "QuizAPI"
13
+ STAGE_NAME = "prod"
13
14
14
15
class TestLocalStackClient :
15
16
client = localstack .sdk .chaos .ChaosClient ()
@@ -28,7 +29,7 @@ def api_endpoint(apigateway_client):
28
29
raise Exception (f"API { API_NAME } not found." )
29
30
30
31
API_ID = api ['id' ]
31
- API_ENDPOINT = f"{ LOCALSTACK_ENDPOINT } /_aws/execute-api/{ API_ID } /test "
32
+ API_ENDPOINT = f"{ LOCALSTACK_ENDPOINT } /_aws/execute-api/{ API_ID } /{ STAGE_NAME } "
32
33
33
34
print (f"API Endpoint: { API_ENDPOINT } " )
34
35
You can’t perform that action at this time.
0 commit comments