-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d64d83f
commit 62a90ae
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy to AWS Lambda | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install AWS SAM CLI | ||
run: | | ||
pip install aws-sam-cli | ||
- name: Deploy to AWS Lambda | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: | | ||
sam deploy \ | ||
--template-file packaged.yaml \ | ||
--stack-name hue-lighting-stack \ | ||
--capabilities CAPABILITY_IAM \ | ||
--parameter-overrides BridgeIP=${{ secrets.BRIDGE_IP }} HueUsername=${{ secrets.HUE_USERNAME }} \ | ||
--no-confirm-changeset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
Transform: AWS::Serverless-2016-10-31 | ||
Description: Hue API Lambda function template | ||
|
||
Parameters: | ||
BridgeIP: | ||
Type: String | ||
Description: "IP address of the Hue Bridge" | ||
HueUsername: | ||
Type: String | ||
Description: "Username for the Hue Bridge API" | ||
|
||
Resources: | ||
HueLightingFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: lambda_function.lambda_handler | ||
Runtime: python3.12 | ||
CodeUri: . | ||
MemorySize: 128 | ||
Timeout: 3 | ||
Environment: | ||
Variables: | ||
BRIDGE_IP: !Ref BridgeIP | ||
HUE_USERNAME: !Ref HueUsername | ||
Policies: | ||
- AWSLambdaBasicExecutionRole | ||
- Statement: | ||
- Effect: Allow | ||
Action: lambda:InvokeFunction | ||
Principal: apigateway.amazonaws.com | ||
Resource: arn:aws:lambda:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:function:<LAMBDA_FUNCTION_NAME> |