Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
151 lines (145 sloc) 4.08 KB
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: EKSphemeral, a simple Amazon EKS manager for ephemeral dev/test clusters
Globals:
Function:
Timeout: 30
Api:
Cors:
AllowMethods: "'*'"
AllowHeaders: "'*'"
AllowOrigin: "'*'"
Parameters:
ClusterMetadataBucketName:
Type: String
NotificationFromEmailAddress:
Type: String
Resources:
StatusFunc:
Type: AWS::Serverless::Function
Properties:
CodeUri: bin/
Handler: status
Runtime: go1.x
Tracing: Active
Environment:
Variables:
CLUSTER_METADATA_BUCKET: !Sub "${ClusterMetadataBucketName}"
Events:
CatchAll:
Type: Api
Properties:
Path: /status/{clusterid}
Method: GET
Policies:
- AWSLambdaExecute
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- eks:DescribeCluster
Resource: '*'
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetBucket
- s3:GetObject
- s3:ListObjects
Resource:
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}/*"
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}"
CreateClusterFunc:
Type: AWS::Serverless::Function
Properties:
CodeUri: bin/
Handler: createcluster
Runtime: go1.x
Tracing: Active
Environment:
Variables:
CLUSTER_METADATA_BUCKET: !Sub "${ClusterMetadataBucketName}"
NOTIFICATION_EMAIL_ADDRESS: !Sub "${NotificationFromEmailAddress}"
Events:
CatchAll:
Type: Api
Properties:
Path: /create
Method: POST
Policies:
- AWSLambdaExecute
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- ses:*
- eks:*
Resource: '*'
- Effect: Allow
Action:
- s3:PutObject
Resource: !Sub "arn:aws:s3:::${ClusterMetadataBucketName}/*"
DestroyClusterFunc:
Type: AWS::Serverless::Function
Properties:
CodeUri: bin/
Handler: destroycluster
Runtime: go1.x
Tracing: Active
Environment:
Variables:
CLUSTER_METADATA_BUCKET: !Sub "${ClusterMetadataBucketName}"
NOTIFICATION_EMAIL_ADDRESS: !Sub "${NotificationFromEmailAddress}"
Events:
Timer:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
Policies:
- AWSLambdaExecute
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- cloudformation:*
- iam:*
- ec2:*
- autoscaling:*
- eks:*
- ses:*
Resource: '*'
- Effect: Allow
Action:
- s3:*
Resource:
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}/*"
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}"
ProlongFunc:
Type: AWS::Serverless::Function
Properties:
CodeUri: bin/
Handler: prolongcluster
Runtime: go1.x
Tracing: Active
Environment:
Variables:
CLUSTER_METADATA_BUCKET: !Sub "${ClusterMetadataBucketName}"
Events:
CatchAll:
Type: Api
Properties:
Path: /prolong/{clusterid}/{timeinmin}
Method: POST
Policies:
- AWSLambdaExecute
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:*
Resource:
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}/*"
- !Sub "arn:aws:s3:::${ClusterMetadataBucketName}"
Outputs:
EKSphemeralAPIEndpoint:
Description: "The EKSphemeral HTTP API Gateway endpoint URL for Prod env"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod"
You can’t perform that action at this time.