Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure AWS #2

Merged
merged 7 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/aws-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---

##########################################################
# AWS Configuration file for NodeJS Deploy GitHub Action #
# #
# NOTE: This file holds the variables needed #
# to configure the GitHub Deploy NodeJS #
# on AWS Serverless #
# #
# This file needs to be in the location: #
# - .github/aws-config.yml #
# in your repository to be parsed at run time #
##########################################################

########################################
# AWS S3 Bucket for package and deploy #
########################################
# NOTE: This bucket must exist before the GitHub Action, and match the name of your S3 bucket on Amazon
s3_bucket: github-tic-tac-toe

##################################
# AWS Cloud Formation Stack name #
##################################
# NOTE: Defaults to "mystack" if left empty
aws_stack_name: mystack

####################
# AWS SAM Template #
####################
# NOTE: This is the AWS SAM template.yml file that we need to deploy
# Pathing is from root of repository:
# Example:
# if file is called `template.yml` and is in the root of repository
# under the '.github' folder:
# sam_template: .github/template.yml
sam_template: sam-template.yml

################################
# region for connection to AWS #
################################
# Default region is: us-west-2
# if not provided below
region: eu-west-1
49 changes: 49 additions & 0 deletions sam-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Transform: 'AWS::Serverless-2016-10-31'
Resources:

MainFunction:
# This resource creates a Lambda function.
Type: 'AWS::Serverless::Function'

Properties:

# This function uses the Nodejs v12 runtime.
Runtime: nodejs12.x

# This is the Lambda function's handler.
Handler: handler.lambdaHandler

# The location of the Lambda function code.
CodeUri: .

# Event sources to attach to this function. In this case, we are attaching
# one API Gateway endpoint to the Lambda function. The function is
# called when a HTTP request is made to the API Gateway endpoint.
Events:

MainPage:
# Define an API Gateway endpoint that responds to HTTP GET at /thumbnail
Type: Api
Properties:
Path: /
Method: GET
CSSFile:
# Define an API Gateway endpoint that responds to HTTP GET at /thumbnail
Type: Api
Properties:
Path: /public/index.css
Method: GET
JSFile:
# Define an API Gateway endpoint that responds to HTTP GET at /thumbnail
Type: Api
Properties:
Path: /public/main.js
Method: GET

Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
StagingUrl:
Description: "Staging URL"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"