Developing with Amazon Web Services, Microsoft Azure, and Google Cloud
Maddie Stigler
Book Details
Price
|
3.00 USD |
---|---|
Pages
| 207 p |
File Size
|
9,666 KB |
File Type
|
PDF format |
ISBN-13 (electronic) ISBN-13 (pbk)
| 978-1-4842-3084-8 978-1-4842-3083-1 |
Copyright
| 2018 by Maddie Stigler |
Maddie Stigler is a professional developer for a consulting firm based
in Richmond, Virginia. She is a part of the core team for Women Who
Code in Richmond and is involved in many local Microsoft and Amazon
meetups. Her interest in cloud computing began while studying computer
science at the University of Virginia and has only grown since then.
Maddie has maintained a fascination with serverless technology from the
start and has applied principles of serverless design and architecture both
in her professional and personal work, including developing a flight status
service for travel insurance customers using AWS Lambda and Node.js.
Her favorite application to date has been creating Amazon Alexa skills by
utilizing Lambda functions written in Node.js and triggering them with the
Alexa Skills Kit. Maddie plans to continue pursuing her interest in growing
cloud technologies and serverless architecture and share her knowledge
so that others can do the same.
About the Technical Reviewer
Brandon Atkinson is an accomplished technology leader with over
14 years of industry experience encompassing analysis, design,
development, and implementation of enterprise-level solutions. His
passion is building scalable teams and enterprise architecture that can
transform businesses and alleviate pain points. Brandon leads technology
projects, helping to shape the vision, providing technical thought
leadership, and implementation skills to see any project through. He has
extensive experience in various technologies/methodologies including:
Azure, AWS, .NET, DevOps, Cloud, JavaScript, Angular, Node.js, and more.
When not building software, Brandon enjoys time with his wife and
two girls in Richmond, VA.
Table of Contents
About the Author ..................................................................................................... xi
About the Technical Reviewer ............................................................................... xiii
■Chapter 1: Understanding Serverless Computing
What Is Serverless Computing? ....................................................................................... 1
Serverless As an Event-Driven Computation .......................................................................................... 1
Functions as a Service (FaaS) ................................................................................................................2
How Does Serverless Computing Work? ................................................................................................ 3
How Is It Different? ........................................................................................................... 4
Development ...........................................................................................................................................5
Independent Processes ..........................................................................................................................5
Benefits and Use Cases .................................................................................................... 6
Rapid Development and Deployment ..................................................................................................... 7
Ease of Use .............................................................................................................................................7
Lower Cost ..............................................................................................................................................7
Enhanced Scalability ..............................................................................................................................7
Netflix Case Study with AWS .................................................................................................................. 8
Limits to Serverless Computing ....................................................................................... 9
Control of Infrastructure .........................................................................................................................9
Long-Running Server Application ...........................................................................................................9
Vendor Lock-In .....................................................................................................................................10
“Cold Start” ..........................................................................................................................................12
Shared Infrastructure ...........................................................................................................................13
Limited Number of Testing Tools ...........................................................................................................13
Conclusion ...................................................................................................................... 14
■Chapter 2: Getting Started
What Each Provider Offers ............................................................................................. 15
AWS Lambda ........................................................................................................................................15
Azure Functions ....................................................................................................................................17
Google Cloud Functions ........................................................................................................................19
Explore Triggers and Events ........................................................................................... 20
What Are Triggers? ...............................................................................................................................20
Triggers within Cloud Providers ............................................................................................................22
Development Options, Toolkits, SDKs ............................................................................. 22
TypeScript with Node.JS .......................................................................................................................22
AWS SDK ...............................................................................................................................................24
Azure SDK .............................................................................................................................................26
Google Cloud SDK .................................................................................................................................27
Developing Locally vs. Using the Console ...................................................................... 28
Local Development ...............................................................................................................................28
Deployment of Functions and Resources .............................................................................................28
Developing and Testing in the Cloud Console ....................................................................................... 30
The Tools ........................................................................................................................ 30
Installing VS Code or Choosing Your IDE ...............................................................................................30
Node.js ..................................................................................................................................................30
Postman ................................................................................................................................................32
Environment Setup ......................................................................................................... 33
Navigating VS Code ..............................................................................................................................34
Node Package Manager: What It Does and How to Use It .................................................................... 37
Serverless Framework .........................................................................................................................38
Organizing your Development Environment ......................................................................................... 38
Conclusion ...................................................................................................................... 40
■Chapter 3: Amazon Web Services
Explore the UI ................................................................................................................. 41
Navigation .............................................................................................................................................42
Pricing ..................................................................................................................................................44
Lambda .................................................................................................................................................45
Security IAM ................................................................................................................... 47
IAM Console ..........................................................................................................................................47
Roles, Policies, and Users .....................................................................................................................48
Roles for Lambda ..................................................................................................................................49
Your First Code ............................................................................................................... 50
Hello World ...........................................................................................................................................50
Testing ..................................................................................................................................................52
CloudWatch ...........................................................................................................................................55
Environment Variables .................................................................................................... 57
What Are Environment Variables .......................................................................................................... 57
Using Environment Variables in Hello World ......................................................................................... 58
HTTP Event ..................................................................................................................... 59
Exploring API Gateway ..........................................................................................................................60
Using API Gateway as a Trigger ............................................................................................................65
Response to Trigger ..............................................................................................................................68
Storage Event ................................................................................................................. 74
Amazon S3 ............................................................................................................................................74
Using S3 as a Trigger ............................................................................................................................75
Response to Trigger ..............................................................................................................................77
Conclusion ...................................................................................................................... 81
■Chapter 4: Azure
Explore the UI ................................................................................................................. 83
Navigation .............................................................................................................................................84
Pricing ..................................................................................................................................................88
Azure Functions ....................................................................................................................................89
Azure Security ................................................................................................................ 91
Implement Recommendations ..............................................................................................................93
Set Security Policies .............................................................................................................................94
Your First Code ............................................................................................................... 95
Hello World ...........................................................................................................................................96
Testing ................................................................................................................................................101
Application Insights ............................................................................................................................103
HTTP Events ................................................................................................................ 107
Create a GitHub WebHook Trigger .......................................................................................................107
Build Upon Our Hello World API Trigger ...............................................................................................111
The Storage Event ........................................................................................................ 117
Azure Queue Storage ..........................................................................................................................117
Create the Function ............................................................................................................................118
Microsoft Azure Storage Explorer .......................................................................................................120
Finish Our Function ............................................................................................................................123
Conclusion .................................................................................................................... 128
■Chapter 5: Google Cloud
Explore the UI ............................................................................................................... 129
Navigation ...........................................................................................................................................131
Pricing ................................................................................................................................................132
Cloud Functions ..................................................................................................................................134
Security IAM ................................................................................................................. 135
IAM Console ........................................................................................................................................135
Roles ...................................................................................................................................................136
Policies ...............................................................................................................................................137
Your First Code ............................................................................................................. 138
Hello World .........................................................................................................................................139
Stackdriver Logging ............................................................................................................................141
Stage Bucket ......................................................................................................................................145
HTTP Event ................................................................................................................... 149
Firebase Realtime Database ...............................................................................................................151
Storage Event ............................................................................................................... 160
Create our Storage Triggered Function ............................................................................................... 160
Reacting to the Triggered Event ..........................................................................................................163
Pub/Sub Event .............................................................................................................. 168
What Is Google Cloud Pub/Sub? .........................................................................................................168
Creating Our Pub/Sub Function ..........................................................................................................170
Conclusion .................................................................................................................... 173
■Chapter 6: An Agnostic Approach
Need for Agnostic Solutions ......................................................................................... 175
The Current State ...............................................................................................................................175
Business Problems .............................................................................................................................179
Recommended Solution .....................................................................................................................180
Define the Approach ..................................................................................................... 181
Explore the Code .......................................................................................................... 186
Code and Example Using the Database ........................................................................ 190
Conclusion .................................................................................................................... 195
Index ..................................................................................................................... 197
Cover image designed by Freepik
Managing Director: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Joan Murray
Development Editor: Laura Berendson
Technical Reviewer: Brandon Atkinson
Coordinating Editor: Jill Balzano
Copy Editor: James A. Compton
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global