Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

AWS Lambda + AWS Cloudformation

374 views

Published on

Meanwhile some people are still moving from pets to cattle the next innovation seems to be no servers at all (serverless architecture). In this field Amazon offers their Lambda service and here you'll learn its power and limits. Are they really limits? How many of them can we circumvent?

This technology fits very well the use case of system administrator tooling because we are too busy taking care of legacy systems and other hidden elephants. We must give an example of how far can we go, and what a better way than developing serverless infrastructure code.

Published in: Software
  • Be the first to comment

  • Be the first to like this

AWS Lambda + AWS Cloudformation

  1. 1. AWS Lambda + AWS Cloudformation Jordi Miguel March 2016
  2. 2. What is AWS Lambda? • Compute Platform • Stateless • Event-driven • Subsecond billing
  3. 3. A compute service where you DON'T have to think about: • Servers • Deployments • Scaling and fault tolerance • OS or language updates • Metrics and logging
  4. 4. ... but where you can easily: • Bring your own code... even native libraries • Run code in parallel • Create backends, event handlers, and data processing systems • Never pay for idle!!!
  5. 5. Execution environments: • Linux kernel version: 4.1.13 Runtime environments: • Node.js: v0.10.36 • Java: 8.0 • Python: 2.7
  6. 6. What if I want to run other languages: • Go: http://apex.run • Bash • C/C++ • Groovy
  7. 7. What is AWS Cloudformation? • Orchestration service • Declarative • Customized via Parameters • No Extra Charge
  8. 8. How does it work?
  9. 9. Get a closer look to the template file: { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "A simple Amazon EC2 instance", "Resources" : { "MyEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : "ami-2f726546", "InstanceType" : "t1.micro" } } } }
  10. 10. Can I create any resource this way??
  11. 11. There is a big list that covers pretty much all essentials: • AWS::EC2 • AWS::AutoScaling • AWS::ElasticLoadBalancer • AWS::RDS • ...
  12. 12. For everything else... AWS::CloudFormation::CustomResource
  13. 13. Types of Custom Resources: • SNS backed • Lambda backed
  14. 14. Basic definition: "MyCustomResource" : { "Type" : "Custom::LambdaBackedExample", "Properties" : { "ServiceToken": { "Fn::Join": [ "", [ "arn:aws:lambda:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":function:", {"Ref" : "LambdaFunctionName"} ] ] } } }
  15. 15. Lambda input event: { "RequestType" : "Create", "ResponseURL" : "http://pre-signed-S3-url-for-response", "StackId" : "arn:aws:cloudformation:us-west-2:123456789012:stack/stack-name/guid", "RequestId" : "unique id for this create request", "ResourceType" : "Custom::LambdaBackedExample", "LogicalResourceId" : "MyCustomResource", "ResourceProperties" : { "foo" : "urls", "bar" : [ "http://mysite.com", "http://myecommercesite.com/", "http://search.mysite.com" ], } }
  16. 16. Cloudformation response: { "Status" : "SUCCESS", "PhysicalResourceId" : "Tester1", "StackId" : "arn:aws:cloudformation:us-west-2:123456789012:stack/stack-name/guid", "RequestId" : "unique id for this create request", "LogicalResourceId" : "MySeleniumTester", "Data" : { "resultsPage" : "http://www.myexampledomain/test-results/guid", "lastUpdate" : "2012-11-14T03:30Z", } }
  17. 17. You can find this info on Amazon doc, of course...
  18. 18. What about the UNTOLD?? • Header Content-type for ResponseURL • Content of "Data" object • Lambda unresponsive • Lambda serializer
  19. 19. DEMO TIME!!

×