Getting Apex to play nicely with AWS API Gateway
Whilst learning Apex I found an interesting issue getting the AWS API Gateway integration working.
Following the instructions the order of play is
-
apex init
-
apex infra plan
-
apex infra apply
-
apex deploy
If you copy the required files from the example in the following order
-
apex init
-
cp /tmp/apex/_example/infrastructure/dev/api-gateway* infrastructure/dev/
-
apex infra plan
It errors out as follows.
Errors: * 1 error(s) occurred: * Required variable not set: apex_function_hello ⨯ Error: exit status 1
Appears the correct order is
-
apex init
-
apex infra plan
-
apex infra apply
-
apex deploy
-
cp /tmp/apex/_example/infrastructure/dev/api-gateway* infrastructure/dev/
-
apex infra plan
-
apex infra apply
You can then go and check the API works in the AWS Console.