Created
September 19, 2017 21:30
-
-
Save jmelloy/32ef58332461f020a0fc7b02aa5c8c4c to your computer and use it in GitHub Desktop.
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
# Welcome to Serverless! | |
# | |
# This file is the main config file for your service. | |
# It's very minimal at this point and uses default values. | |
# You can always add more config options for more control. | |
# We've included some commented out config examples here. | |
# Just uncomment any of them to get that config option. | |
# | |
# For full config options, check the docs: | |
# docs.serverless.com | |
# | |
# Happy Coding! | |
service: ec2-scheduler | |
# You can pin your service to only deploy with a specific Serverless version | |
# Check out our docs for more details | |
# frameworkVersion: "=X.X.X" | |
provider: | |
name: aws | |
runtime: python3.6 | |
stage: dev | |
region: us-west-2 | |
# you can add statements to the Lambda function's IAM Role here | |
iamRoleStatements: | |
- Effect: "Allow" | |
Action: | |
- "ec2:Desc*" | |
- "ec2:List*" | |
Resource: | |
- "*" | |
- Effect: "Allow" | |
Action: | |
- dynamodb:GetItem | |
- dynamodb:PutItem | |
Resource: | |
- arn:aws:dynamodb:*:*:table/${self:custom.account} | |
# - Effect: "Allow" | |
# Action: | |
# - "s3:PutObject" | |
# Resource: | |
# Fn::Join: | |
# - "" | |
# - - "arn:aws:s3:::" | |
# - "Ref" : "ServerlessDeploymentBucket" | |
# - "/*" | |
custom: | |
region: ${self:provider.region} | |
stage: ${opt:stage, self:provider.stage} | |
prefix: ${self:service}-${self:custom.stage} | |
account: ${self:custom.prefix}-account | |
package: | |
exclude: | |
- schedulerweb/** | |
- schedulerweb | |
- scripts/* | |
# - exclude-me.py | |
# - exclude-me-dir/** | |
functions: | |
accounts: | |
handler: dynamodb.accounts | |
events: | |
- http: | |
path: accounts | |
method: get | |
cors: true | |
environment: | |
account_table: ${self:custom.account} | |
list_instances: | |
handler: ec2.list_instances | |
events: | |
- http: | |
path: ec2/list | |
method: get | |
cors: true | |
instance: | |
handler: ec2.instance | |
events: | |
- http: | |
path: ec2/instance | |
method: get | |
cors: true | |
resources: | |
Resources: | |
Accounts: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
TableName: ${self:custom.account} | |
AttributeDefinitions: | |
- AttributeName: key | |
AttributeType: S | |
KeySchema: | |
- AttributeName: key | |
KeyType: HASH | |
ProvisionedThroughput: | |
ReadCapacityUnits: 5 | |
WriteCapacityUnits: 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment