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.

AngularJS
on Cloud
AngularConf 2015
Who am I?
Gianluca Arbezzano
@gianarb 
I'm here to protect you
Software Engineer @CorleyCloud
When you think "Infrastructure"
 
Think of word without SysAdmin
Great!
 
The mission:
build an application managed by
AWS
to avoid sysadmin
 

Security Issues
Without servers
where do you store private credentials?
Cognito identity
Helps your client app to manage authentication
and it opens the doors of AWS world
in AngularJS
// app/app.js
.config([function() {
  var creds = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'u...
in AngularJS
ng-newsletter.com/aws-js-sdk
in AngularJS
.directive('googleSignin', function() {
  return {
    restrict: 'A',
    template: '<span id="signinButton">...
in AngularJS
// app/view/view.tpl.html
<p>This is the partial for view 1.</p>
<h2>Signin to ngroad</h2>
<div google­signin...
in AngularJS
$scope.signedIn = function(oauth) {
    var creds = {
      params: {}
    };
    $scope.user = oauth;
    cr...
Chamber of Secrets was open
in AngularJS
DynamoDB
is a fully managed NoSQL database service that erovides
fast
and predictable performance
with seamless scalability
in AngularJS
in AngularJS
in AngularJS
<p>This is the partial for view 1.</p>
<h2>Signin to ngroad</h2>
<div google­signin
  client­id='38182010900­...
in AngularJS
$scope.send = function(item) {
    AWS.config.getCredentials(function(){
      var dynamodb = new AWS.DynamoD...
DynamoDB
DynamoDB
working on your data
Allow permission for single
lines
Allow permission for single
columns
working on your data
{
    "Version": "2012­10­17",
    "Statement": [
        {
            "Effect": "Allow",
          ...
Other AWS services
SQS
S3
Cognito Sync

docs.aws.amazon.com/AWSJavaScriptSDK
Thanks
github.com/gianarb
Corley cloud   angular in cloud
Corley cloud   angular in cloud
Corley cloud   angular in cloud
Corley cloud   angular in cloud
Upcoming SlideShare
Loading in …5
×

Corley cloud angular in cloud

695 views

Published on

Realtime and remote service integration into the our AngularJS Application, a travel around the best servies to build a serverless application. AWS Lambda, DynamoDB.

Published in: Engineering
  • Be the first to comment

Corley cloud angular in cloud

  1. 1.  AngularJS on Cloud AngularConf 2015
  2. 2. Who am I? Gianluca Arbezzano @gianarb 
  3. 3. I'm here to protect you
  4. 4. Software Engineer @CorleyCloud
  5. 5. When you think "Infrastructure"
  6. 6.  
  7. 7. Think of word without SysAdmin
  8. 8. Great!
  9. 9.  
  10. 10. The mission: build an application managed by AWS to avoid sysadmin
  11. 11.  
  12. 12.  Security Issues Without servers where do you store private credentials?
  13. 13. Cognito identity Helps your client app to manage authentication and it opens the doors of AWS world
  14. 14. in AngularJS // app/app.js .config([function() {   var creds = new AWS.CognitoIdentityCredentials({     IdentityPoolId: 'us­east­1:0000000000000008c3c­5397a17ad174'   });   AWS.config.update({     region: 'us­east­1',     credentials: creds   }); }]);                     
  15. 15. in AngularJS ng-newsletter.com/aws-js-sdk
  16. 16. in AngularJS .directive('googleSignin', function() {   return {     restrict: 'A',     template: '<span id="signinButton"></span>',     replace: true,     scope: {       afterSignin: '&'     },     link: function(scope, ele, attrs) {         //  see ng­newsletter.com/posts/aws­js­sdk.html     }   }; })                     
  17. 17. in AngularJS // app/view/view.tpl.html <p>This is the partial for view 1.</p> <h2>Signin to ngroad</h2> <div google­signin   client­id='3818201'   after­signin="signedIn(oauth)" data­user="user"></div> <pre>{{ user | json }}</pre>                     
  18. 18. in AngularJS $scope.signedIn = function(oauth) {     var creds = {       params: {}     };     $scope.user = oauth;     creds = AWS.config.credentials;     creds.params.Logins = {};     creds.params.Logins['accounts.google.com'] = oauth.id_token;     AWS.config.update({       credentials: creds     });     AWS.config.credentials.refresh(function(err){       if (err) {         console.log(err);       }     });   };
  19. 19. Chamber of Secrets was open
  20. 20. in AngularJS
  21. 21. DynamoDB is a fully managed NoSQL database service that erovides fast and predictable performance with seamless scalability
  22. 22. in AngularJS
  23. 23. in AngularJS
  24. 24. in AngularJS <p>This is the partial for view 1.</p> <h2>Signin to ngroad</h2> <div google­signin   client­id='38182010900­e5l22mddk7oliohktn747trqgsfau1rd'   after­signin="signedIn(oauth)" data­user="user"></div> <pre>{{ user | json }}</pre> <form ng­submit="send(item)"> <input ng­model="item.title"> <button type="submit">Save</button> </form>                     
  25. 25. in AngularJS $scope.send = function(item) {     AWS.config.getCredentials(function(){       var dynamodb = new AWS.DynamoDB({apiVersion: '2012­08­10'});       dynamodb.putItem({         Item: {           "title": {"S": item.title}         },         TableName: "angular­conf"       }, function(err, data) {         if(err) { throw err; }       });     }); };                     
  26. 26. DynamoDB
  27. 27. DynamoDB
  28. 28. working on your data Allow permission for single lines Allow permission for single columns
  29. 29. working on your data {     "Version": "2012­10­17",     "Statement": [         {             "Effect": "Allow",             "Action": [                 "dynamodb:GetItem",                 "dynamodb:PutItem",                 "dynamodb:UpdateItem",                 "dynamodb:DeleteItem"             ],             "Resource": ["arn:aws:dynamodb:us­west­2::table/GameScores"],             "Condition": {                 "ForAllValues:StringEquals": {                     "dynamodb:LeadingKeys": ["${www.amazon.com:user_id}"]}             }         }     ] }
  30. 30. Other AWS services SQS S3 Cognito Sync  docs.aws.amazon.com/AWSJavaScriptSDK
  31. 31. Thanks github.com/gianarb

×