Hybrid Cloud for Developers
Develop and deploy cost-effective applications on the AWS and OpenStack platforms with ease
Manoj Hirway
BIRMINGHAM - MUMBAI
Hybrid Cloud for Developers
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means,
without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the
information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its
dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the
appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin Boricha
Acquisition Editor: Rohit Rajkumar
Content Development Editor: Sharon Raj
Technical Editor: Mohit Hassija
Copy Editor: Safis Editing
Project Coordinator: Virginia Dias
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Tom Scaria
Production Coordinator: Shantanu Zagade
First published: April 2018
Production reference: 1190418
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78883-087-4
www.packtpub.com
I dedicate this book to my lovely daughter, Pavitraa,
who has been my constant source of energy.
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as
industry leading tools to help you plan your personal development and advance your career. For more
information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over
4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files
available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you
are entitled to a discount on the eBook copy. Get in touch with us at for more
details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free
newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Manoj Hirway has extensive industrial experience on various cloud and virtualization technologies.
He is currently working as a solutions architect in a fast-growing start-up at Pune. He acquired a
bachelor's degree in computer engineering from Pune Institute of Computer Technology. He loves to
explore new technologies. He wishes to help our readers by sharing his knowledge about the tech
trends on the market.
This book would not have been possible without the support of my publisher, Packt Publishing. I wish to especially thank
Sharon Raj and Rohit Rajkumar for their guidance in creating this book.
I am also grateful to my wife, Bhakti, my brother, Pankaj, and my parents, Mala and Nagesh for supporting me throughout the
journey of this book.
About the reviewers
Neelesh Gurjar, working as a DevOps lead, helps organizations to automate their software
development phases, along with designing and implementing cloud infrastructures in various cloud
service providers. He has more than 13 years of experience in IT. He is an expert in AWS, Google
Cloud, DevOps, and Linux. He is AWS Certified Solution Architect Professional.
Vaibhav Bhatkar is an infrastructure, automation, and a security expert. Throughout his career, he
has been deeply involved in designing, developing, and deploying on-premise/cloud/hybrid
infrastructures, monitoring, and storage. He has consulted various start-ups at different growth stages
to provide guidance on their data center and infrastructure hosting strategies. He is an EC council
certified ethical hacker and a security analyst. He is currently leading the infrastructure team at a
start-up.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today.
We have worked with thousands of developers and tech professionals, just like you, to help them
share their insight with the global tech community. You can make a general application, apply for a
specific hot topic that we are recruiting an author for, or submit your own idea.
Table of Contents
Title Page
Copyright and Credits
Hybrid Cloud for Developers
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Code in action
Conventions used
Get in touch
Reviews
1.
Introducing Hybrid Clouds
Understanding hybrid clouds
What is cloud computing?
Software as a Service
Platform as a Service
Infrastructure as a Service
Characteristics of a cloud
Types of cloud
Private cloud
Public cloud
Technologies used by cloud providers
Introducing hybrid cloud
Hybrid cloud architecture
Hybrid cloud using OpenStack and AWS/Azure/GCP
What qualifies as a hybrid cloud?
Cloud bursting in a hybrid cloud
Advantages of using hybrid cloud
Cost savings
Flexibility
Speed
Portability
Security
Factors to consider before moving to a hybrid cloud
Understanding DevOps methodology
Collaboration
Automation
Continuous integration
Continuous testing
Summary
2.
Exploring AWS Cloud
Introducing AWS Cloud
Amazon Web Service features
Creating an AWS account
Amazon EC2
AMI
EC2 instance types
EC2 instance IP addressing
EC2 instance security groups
Launching an EC2 instance from the web console
Amazon EBS
Creating an AWS EBS volume
Snapshot of EBS volumes
Amazon S3
S3 bucket properties
Creating an S3 bucket using the AWS console
Uploading/downloading files to and from an S3 bucket
Using the AWS command-line interface
Using HTTP GET method or wget
Using AWS S3 API
Using the AWS console
Amazon VPC
Creating an AWS VPC
VPC configurations
Scenario 1 – VPC with public subnet only
Scenario 2 – VPC with public and private subnet
Scenario 3 – VPC with public and private subnet and VPN connectivity
Scenario 4 – VPC with private subnet only and VPN connectivity
VPC peering
Summary
3.
Exploring OpenStack Private Cloud
Introducing OpenStack
OpenStack architecture
Installing OpenStack
NOVA – OpenStack Compute Service
Neutron – OpenStack Networking Service
Tenant networks
Provider networks
Glance – OpenStack Imaging Service
Cinder – OpenStack Block Storage Service
Keystone – OpenStack Identity Service
Horizon – OpenStack Dashboard Service
Heat – OpenStack Orchestration Service
Ironic – OpenStack bare metal provisioning
OpenStack workflow – launching a new virtual machine
Summary
4.
Developing AWS Cloud Applications
Technical requirements
AWS – Software Development Kit (SDK)
Setting up an AWS development environment on Visual Studio
Setting up a Unix development environment for Python
Developing Amazon S3 applications – Windows
Creating an S3 bucket
Listing S3 buckets
Uploading files to the S3 bucket
Downloading files from the S3 bucket
Listing files in an S3 bucket
Deleting a file in an S3 bucket
Developing AWS S3 applications – Unix
Creating a bucket
Uploading files to S3
Listing S3 buckets
Downloading files from the S3 bucket
Deleting objects/files from a bucket
Deleting a bucket
Developing Amazon EC2 applications – Windows
Launching an EC2 instance
Checking the state of your EC2 instance
Connecting to the instance
Terminating the EC2 instance
Developing Amazon EC2 applications – Unix
Launching an EC2 instance in Python
Listing EC2 instances in Python
Terminating an EC2 instance in Python
Developing Amazon RDS applications – Windows
DB Instance and instance classes
Creating an RDS instance
Listing the RDS database instances
Connecting to the database instance
Deleting the RDS database instance
Developing Amazon RDS applications – Unix
Creating an RDS instance
Listing the database instances
Connecting to the database instance
Deleting the RDS database instance
Developing Amazon SNS applications – Windows
Creating a topic
Subscribing to a topic
Publishing messages
Deleting the topic
Developing Amazon SNS applications – Unix
Creating a topic
Subscribing to a topic
Publishing a message
Deleting a topic
Developing Amazon SQS applications – Windows
Creating an SQS queue
Listing the available queues
Sending a message to the queue
Receiving a message from the queue
Deleting a message from the queue
Developing Amazon SQS applications – Unix
Creating an SQS queue
Sending a message to the queue
Receiving a message from the queue
Deleting messages from the queue
Amazon CloudFormation service
How CloudFormation works
A CloudFormation template
Executing the CloudFormation template
Summary
5.
Developing OpenStack Applications
Technical requirements
Introduction to OpenStack SDK
Go
Java
JavaScript
.NET
PHP
Ruby
C
C++
Perl
Python
Creating an application development environment for OpenStack
Writing your first OpenStack application
Developing OpenStack image service applications
Listing images
Downloading a VM image
Uploading an image
Deleting the image
Developing OpenStack compute applications
Listing nova networks
Creating an SSH key-pair
Launching a VM
Starting a VM
Stopping a VM
Rebooting a VM
Pausing a VM
Unpausing a VM
Creating an image from a VM
IP address
Adding a fixed IP address
Removing a fixed IP address
Adding a floating IP address
Removing a floating IP address
Security groups
Adding a security group to a VM
Removing a security group from a VM
Listing security groups
Flavors
Listing flavors
Creating a flavor
Deleting a flavor
Developing OpenStack networking applications
Networks
Creating a network/subnet
Listing networks
Listing subnets
Listing ports
Listing routers
Listing network agents
Deleting a network
Creating a security group
Developing OpenStack Identity Service applications
User management
Creating a user
Deleting a user
Updating a user
Finding a user
Roles
Creating a role
Updating a role
Deleting a role
Projects
Creating a project
Updating a project
Deleting a project
Developing block storage applications
Volumes
Creating a volume
Deleting a volume
Volume snapshots
Creating a snapshot
Deleting a snapshot
Developing HEAT orchestration templates
Summary
6.
Cloud Migration
Choosing the right cloud provider
Setting up a hybrid cloud environment
Cloud migration
Application migration strategies
Rehosting
Replatforming
Repurchasing
Refactoring
Retiring
AWS migration tools
AWS Migration Hub
AWS Application Discovery Service
AWS Server Migration Service
AWS Database Migration Service
AWS S3 Transfer Acceleration
AWS Snowball
AWS Snowmobile
AWS Direct Connect
AWS Kinesis Firehouse
Migrating a VM to AWS
Migrating from AWS to OpenStack
Benefits of cloud migration
Risks of cloud migration
Cost benefits of cloud migration
Summary
7.
Hybrid Cloud Best Practices
Hybrid cloud strategy best practices
Pluggable architecture
AWS root account
Security group rules
Data backup
High availability
Cloud monitoring
Cloud automation
Cloud orchestration
Co-locating data and application tiers
Scaling
Vertical scaling
Horizontal scaling
Legacy applications
Resource utilization and costs
Centralized cloud management
Designing for failure
Caching
Retry operation
Limiting requests
Error reporting
Application decoupling
Continuous delivery and integration
Deploying the application at multiple locations
Developing the application locally or in the cloud
Summary
8.
Monitoring and Troubleshooting Hybrid Cloud
Troubleshooting OpenStack
Linux troubleshooting and monitoring tools
Troubleshooting the OpenStack Identity service
Authentication issues
Keystone service issues
Keystone database issues
Troubleshooting the OpenStack Image service
Glance service issues
Glance database issues
Troubleshooting the Networking service
IP address allocation to the VM
Unable to ping to VM
VM cannot reach the external network
Troubleshooting the Compute service
Database issues
Instance issues
Volume issues
Troubleshooting the Block Storage service
Common issues
Troubleshooting the Object Storage service
Swift authentication
Troubleshooting the Orchestration service
Service errors
Stack errors
Troubleshooting AWS
AWS Direct Connect
EC2 instance issues
Instance connection issues
Empty console output
SSH key issues
EBS volume issues
Volume stuck in Attaching state
Volume in Error state
Volume snapshot in Pending state
S3 object store issues
Troubleshooting OpenVPN issues
OpenVPN log files
VPN connection issues
Authentication issues
Starting and stopping OpenVPN
Summary
9.
Hybrid Cloud Security
Hybrid cloud security threats
Lack of encryption
User symmetric key encryption
Encrypting data before uploading to the cloud
Protecting data at rest and in transit with a cloud access security broker
Using a reliable VPN connection
Using SSH
Key management
Lack of compliance
Lack of data backup and replication
Unsecure application APIs
Denial of service attacks
Data leaks
Virtualization software security
Virtual machine security
Patch management
Intrusion detection and prevention
Identity access management
Developing secure applications
Data manipulation
Coding practices
User input validation
Security testing
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think