Skip to content

Commit 91c4863

Browse files
committed
Episode 1
1 parent d4da4b2 commit 91c4863

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# coffee-store
1+
# Coffee Store
2+
3+
Demo app for [Cloud Coffee Break](https://github.com/symphoniacloud/cloud-coffee-break).
4+
5+
## Creating, deploying, calling, and tearing-down
6+
7+
First, make sure you have the prerequisites setup, as described [in the notes for Episode 1](https://github.com/symphoniacloud/cloud-coffee-break/blob/main/episode1/README.md).
8+
9+
Build and Deploy this app as follows:
10+
11+
```
12+
% sam deploy --guided
13+
```
14+
15+
The `--guided` form is useful for beginners since it will walk you through capturing some configuration, which it then saves to a local file. You can use the default answers (just hit enter) apart from the question _HelloWorldFunction may not have authorization defined, Is this okay?_ - to which you must explicitly hit `y`, and enter. For subsequent deployments of the same app, just run `sam deploy` .
16+
17+
If SAM ran successfully then your application is now deployed! To call it, you need to know the URL. You can get that by visiting the API Gateway section of the AWS Web Console at https://console.aws.amazon.com/apigateway - if you don't see your API make sure that the region selector (top right of the page next to "support" is set to the same region as your AWS CLI configuration.) Click on your API and you should be able to see "Invoke URL". If you click on that you should be able to see "Hello World!" output to your browser. Congratulations!
18+
19+
Since this application is available to the public internet you probably want to tear it down when you're done with it. To do so, run the following, changing the stack-name if you used something else in the deployment step:
20+
21+
```
22+
% aws cloudformation delete-stack --stack-name sam-app
23+
```

template.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Transform: AWS::Serverless-2016-10-31
3+
4+
Resources:
5+
HelloWorldFunction:
6+
Type: AWS::Serverless::Function
7+
Properties:
8+
Events:
9+
HttpEvent:
10+
Type: HttpApi
11+
InlineCode: |
12+
exports.handler = async function (event) {
13+
return {
14+
statusCode : 200,
15+
body : "Hello World!"
16+
};
17+
};
18+
Handler: index.handler
19+
Runtime: nodejs12.x

0 commit comments

Comments
 (0)