Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Thijs de Vries committed Jan 3, 2017
1 parent d25cd97 commit 4fe4053
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
get_container_cf.yml
build.sh
create-users.sh
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Working steps
1. Create bucket to put artifacts

aws s3 mb s3://lambda-pipeline

2. Transform the template-file an upload the artifacts

aws cloudformation package --template-file get_container.yaml --output-template-file get_container_cf.yml --s3-bucket lambda-pipeline

3. Deploy the function

aws cloudformation deploy --template-file /Users/tdevries/GIT/lambda-pipeline/get_container_cf.yml --stack-name lambda-pipeline --capabilities CAPABILITY_IAM

# Links
- [Cloudformation package](http://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html)
- [Cloudformation transform](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html)
- [SAML intro](https://aws.amazon.com/blogs/compute/introducing-simplified-serverless-application-deplyoment-and-management/)
- [Python-programming-model](http://docs.aws.amazon.com/lambda/latest/dg/python-programming-model-handler-types.html)
- [API Gateway create](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-from-example.html)
- [Lambda-python-how-to-create-deployment](http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html)
- [Deploying Lambda Functions](http://docs.aws.amazon.com/lambda/latest/dg/deploying-lambda-apps.html)
- [CodePipeline Access Permissions](http://docs.aws.amazon.com/codepipeline/latest/userguide/access-permissions.html)
23 changes: 23 additions & 0 deletions get_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: A starter AWS Lambda function.
Resources:
getcontainer:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.lambda_handler
Runtime: python2.7
Environment:
Variables:
S3_BUCKET: lambda-pipeline
CodeUri: ./get_container/
Description: A starter AWS Lambda function.
MemorySize: 128
Timeout: 3
# Role: 'arn:aws:iam::925284441818:role/lambda_basic_execution'
Events:
Api1:
Type: Api
Properties:
Path: /getcontainer
Method: GET
14 changes: 14 additions & 0 deletions get_container/lambda_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import print_function

import json
import socket

print('Loading function')


def lambda_handler(event, context):
return { 'statusCode': '200',
'body': socket.gethostname(),
'headers': { 'Content-Type': 'application/json' },
} # Echo back the first key value
#raise Exception('Something went wrong')

0 comments on commit 4fe4053

Please sign in to comment.