Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
OpenStack Cloud Computing Cookbook
OpenStack Cloud Computing Cookbook

OpenStack Cloud Computing Cookbook: Over 100 practical recipes to help you build and operate OpenStack cloud computing, storage, networking, and automation , Fourth Edition

Arrow left icon
Profile Icon Kevin Jackson Profile Icon Cody Bunch Profile Icon Egle Sigler Profile Icon James Denton
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (10 Ratings)
Paperback Jan 2018 398 pages 4th Edition
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Kevin Jackson Profile Icon Cody Bunch Profile Icon Egle Sigler Profile Icon James Denton
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (10 Ratings)
Paperback Jan 2018 398 pages 4th Edition
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$9.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

OpenStack Cloud Computing Cookbook

Chapter 2. The OpenStack Client

In this chapter, we will cover the following topics:

  • Introduction – using OpenStack

  • Installing Python on Windows

  • Installing the OpenStack clients

  • Configuring your Linux or macOS environment

  • Configuring your Windows environment

  • Common OpenStack networking tasks

  • Common OpenStack server (instances) tasks

  • Common OpenStack image tasks

  • Common OpenStack identity tasks

  • Common OpenStack storage tasks

  • Common OpenStack orchestration tasks

Introduction – using OpenStack


OpenStack can be interacted with in a number of ways – from using the Horizon (the OpenStack control panel) web interface to, the power of the command line to using third -party software, all of which are transparently integrated with OpenStack. In this chapter, we will introduce the OpenStack Command-Line Interface (CLI) and see how to configure it for use with your installation of OpenStack. The OpenStack command-line tools, like the vast majority of OpenStack, are written in Python. This means that there is a direct dependency on Python being available on the computer that will be running the clients.

When we interact with OpenStack, we are technically making REST API calls to the services that run the Service APIs (Application Programming Interfaces). A REST API defines a set of functions that developers can perform requests and receive responses via HTTP protocol such as GET and POST. The OpenStack command-line clients translate your intuitive commands...

Installing Python on Windows


In order to be able to install the required OpenStack client tools under Windows, we must first prepare our Windows desktop machine with Python. The following applies to Windows 10.

Getting ready

Ensure that you are logged into your desktop and have the following installed:

How to do it…

Configuring your Windows environment can be achieved from Properties of your PC. Follow these instructions to ensure that Python is available in your system path, as well as set the appropriate environment variables under PowerShell:

  1. Navigate to the This PC icon on your desktop and choose Properties, as shown here:

  2. Next, choose Advanced system settings from the menu on the left:

  3. Now, select Environment Variables from the Advanced tab of the System Properties window, as shown here:

  4. To set the path for Python, double-click on the Path entry as shown here...

Installing the OpenStack clients


There are a number of OpenStack clients available that are used to interact with OpenStack from the command line. Historically, each service in OpenStack has its own client. For example, the OpenStack Compute project, Nova, has its own nova client. Similarly, the OpenStack networking project, Neutron, also has its own client called neutron client. And so on.

Officially, there is a convergence to using one client: the OpenStack client. However, not all commands and features are available under this one tool. Moreover, the OpenStack client still requires each individual project command-line tool installed to function; however, it provides a more consistent interface without the need to remember each individual project name.

Getting ready

As we are preparing your desktop for interacting with OpenStack from the command line, you will appreciate that there are a variety of choices you can make for your desktop OS of choice. This section will describe the installation...

Configuring your Linux or macOS environment


The OpenStack tools are configured by setting environment variables in your shell or desktop.

Getting ready

Ensure that you have the OpenStack clients installed as described in the first recipe, Introduction – using OpenStack, in this chapter.

How to do it…

Configuration of your command-line environment is achieved by setting environment variables; however, it is easier and more convenient to place these variables in a file that we can later load into our environment. During the installation, OpenStack-Ansible creates a plain text file called openrc and places this in the /root directory of all the containers created. This file is a great starting point for configuring the environment as it has all the required elements needed to operate your CLI environment.

On your own client, for example, Linux or Mac-based, choose a working directory, such as $HOME/openstack, and create a file called openrc (or a meaningful name of your choice) with the following...

Configuring your Windows environment


Configuring your Windows environment for use with OpenStack requires a little more effort – but the basic premise remains: we're configuring our desktop so that it has access to environment variables, as well as ensuring that our tools, written in Python, are able to execute properly.

Getting ready

The following applies to Windows 10. Ensure that you have followed the steps to install Python.

How to do it…

Carry out the following to load the required environment variables into your Windows session:

  1. To be able to source in the required OpenStack environment functions as we do on a Unix/Linux platform, we can achieve a similar outcome using some PowerShell. In the PowerShell Terminal, go and grab the following PowerShell script and download it into your working client directory (for example C:\Users\Username\OpenStack):

    mkdir OpenStack
    cd OpenStack
    wget https://raw.githubusercontent.com/OpenStackCookbook/vagrant-openstack/master/Source-OpenRC.ps1 -UseBasicParsing...

Common OpenStack networking tasks


This section outlines common OpenStack networking tasks for quick reference only. For more details on using Neutron and how Neutron works – including details of when and where to use features such as Floating IPs and Routers, refer to Chapter 4, Neutron – OpenStack Networking.

Getting ready

Ensure that you have the OpenStack clients installed, as described in the first recipes in this chapter.

How to do it…

Carry out the following steps to create and modify networks in OpenStack:

Creating a network

There are usually two steps to create a network: creating the equivalent of an L2 network, followed by assigning a subnet (and details to it).

  1. First, create the network:

    openstack network create NETWORK_NAME
    
  2. Now create the subnet on this network:

    openstack subnet create SUBNET_NAME
        --network NETWORK_NAME--subnet-range CIDR
    
Creating a provider network (for use with Floating IPs)

To create a floating IP provider network, carry out the following commands. This command...

Common OpenStack server (instances) tasks


This section outlines a number of common commands that can be run when operating with instances (for example, virtual machines). For more detailed information and explanation of each task, refer to Chapter 5, Nova – OpenStack Compute.

Getting ready

Ensure that you have the OpenStack clients installed as described in the first recipes of this chapter.

How to do it…

Carry out the following to launch and manipulate running instances:

Launching an instance

To launch in an instance from the command line, you need the following information:

  • An image

  • A network

  • A flavor

  • An optional security group (default is used otherwise)

  • An optional key (if you intend to access the instance)

Carry out the following steps to launch an instance from the command line:

  1. First, list the images available:

    openstack image list
    
  2. Now we list the networks available (it will be the UUID of the Network we will use):

    openstack network list
    
  3. We need a flavor, if you need reminding of them, list them...

Common OpenStack image tasks


This section outlines a number of steps, intended as a quick overview only, when operating against the OpenStack Image service (known as Glance). For more detailed information and explanation of each task, refer to Chapter 6, Glance – OpenStack Image Service.

Getting ready

Ensure that you have the OpenStack clients installed, as described in the first recipes in this chapter.

How to do it…

Carry out the following steps to create and modify images in OpenStack:

Uploading an image to Glance

Uploading an image to OpenStack is achieved with the following. To upload, a QCOW2 image such as one provided by CirrOS for testing, carry out the following command:

openstack image create
    --container-type bare
    --disk-format qcow2
    --public
    --file
 /path/to/cirros-0.3.5-x86_64-disk.img

Downloading an image or snapshot from Glance as a file

To download an image from Glance, perhaps for copying to another environment or to store as an offsite backup, carry out the following...

Common OpenStack identity tasks


This section outlines a number of common steps to take for a number of common actions using the OpenStack Identity service. This is intended as a quick reference guide only. For more detailed information and explanation of each task, refer to Chapter 3, Keystone – OpenStack Identity Service.

Getting ready

Ensure that you have the OpenStack clients installed, as described in the first recipes of this chapter.

How to do it…

Carry out the following steps to create and modify users and projects in OpenStack:

Creating a new project

Creating a new user in a project is achieved with the following command. For example, to create the project called development, execute the following command:

openstack project create development

Creating a user

To create a user called developer, with a password of password123, carry out the following command:

openstack user create
    --domain default
    --password password123
    --enable
    developer

Adding a user to a project

To add a...

Common OpenStack storage tasks


This section outlines a number of common tasks using the OpenStack Block and Object Storage service. For more information on storage, refer to Chapter 7, Cinder – OpenStack Block Storage and Chapter 8, Swift – OpenStack Object Storage.

Getting ready

Ensure that you have the OpenStack clients installed, as described in the first recipes of this chapter.

How to do it…

Carry out the following steps to create and modify users and projects in OpenStack:

Create a new Cinder volume

To create a new Cinder block storage volume, carry out the following command. The size is in gigabytes:

openstack volume create --size 5 my5GVolume

Attaching a volume

To attach a volume to a running instance, carry out the following command. The running instance UUID is used and can be found by listing the running instances:

openstack server add volume my5GVolume 58ea640b-16ba-447c-85db-952174d70f7c

Detaching a volume

To detach a volume, first unmount it from the running instance as you would normally...

Common OpenStack orchestration tasks


This section outlines a number of common tasks using the OpenStack Orchestration (Heat) service to launch stacks (orchestrated environments using Heat). For more information on Heat and orchestration, refer to Chapter 9, OpenStack Orchestration Using Heat and Ansible.

Getting ready

Ensure that you have the OpenStack clients installed, as described in the first recipes of this chapter.

How to do it…

Carry out the following steps to create and use Heat templates in OpenStack to create orchestrated environments:

Launch a stack from a template and environment file

To launch a stack from a heat orchestration template (hot), issue the following command:

openstack stack create
    --template myStack.yml
    --environment myStack-Env.yml
    myStack

Listing stacks

To list the running stacks, issue the following command:

openstack stack list

Deleting a running stack

To destroy a running stack named myStack, issue the following command:

openstack stack delete myStack

Listing...

Left arrow icon Right arrow icon

Key benefits

  • • Over 100 recipes created by a team of OpenStack experts
  • • Updated to work with the latest OpenStack builds, with recipes covering the installation and use of OpenStack with Ansible
  • • It covers topics such as Keystone, Glance, Neutron, Nova, Cinder, and more, plus recipes for OpenStack storage, networking, and orchestrating workloads
  • • Test drive OpenStack using the accompanying Vagrant environment

Description

This is the fourth edition of the industry-acclaimed OpenStack Cloud Computing Cookbook, created by four recognized OpenStack experts. It has now been updated to work with the latest OpenStack builds, using tools and processes based on their collective and vast OpenStack experience. OpenStack Open Source Cloud software is one of the most used cloud infrastructures to support a wide variety of use cases, from software development to big data analysis. It is developed by a thriving community of individual developers from around the globe and backed by most of the leading players in the cloud space today. We make it simple to implement, massively scalable, and able to store a large pool of data and networking resources. OpenStack has a strong ecosystem that helps you provision your cloud storage needs. Add OpenStack's enterprise features to reduce the cost of your business. This book will begin by showing you the steps to build up an OpenStack private cloud environment using Ansible. You'll then discover the uses of cloud services such as the identity service, image service, and compute service. You'll dive into Neutron, the OpenStack Networking service, and get your hands dirty with configuring networks, routers, load balancers, and more. You’ll then gather more expert knowledge on OpenStack cloud computing by managing your cloud's security and migration. After that, we delve into OpenStack Object storage and you’ll see how to manage servers and work with objects, cluster, and storage functionalities. Finally, you will learn about OpenStack dashboard, Ansible, Keystone, and other interesting topics.

Who is this book for?

This book is written for cloud system engineers, system administrators, and technical architects who are moving from a virtualized environment to cloud environments. This book assumes that you are familiar with cloud computing platforms, and have knowledge of virtualization, networking, and managing Linux environments.

What you will learn

  • • Understand, install, configure, and manage a complete OpenStack Cloud platform using OpenStack-Ansible
  • • Configure networks, routers, load balancers, and more with Neutron
  • • Use Keystone to setup domains, roles, groups and user access
  • • Learn how to use Swift and setup container access control lists
  • • Gain hands-on experience and familiarity with Horizon, the OpenStack Dashboard user interface
  • • Automate complete solutions with our recipes on Heat, the OpenStack Orchestration service as well as using Ansible to orchestrate application workloads
  • • Follow practical advice and examples to run OpenStack in production

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 29, 2018
Length: 398 pages
Edition : 4th
Language : English
ISBN-13 : 9781788398763
Vendor :
OpenStack
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jan 29, 2018
Length: 398 pages
Edition : 4th
Language : English
ISBN-13 : 9781788398763
Vendor :
OpenStack
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 148.97
Mastering OpenStack
$49.99
OpenStack Cloud Computing Cookbook
$54.99
OpenStack for Architects
$43.99
Total $ 148.97 Stars icon
Banner background image

Table of Contents

10 Chapters
Installing OpenStack with Ansible Chevron down icon Chevron up icon
The OpenStack Client Chevron down icon Chevron up icon
Keystone – OpenStack Identity Service Chevron down icon Chevron up icon
Neutron – OpenStack Networking Chevron down icon Chevron up icon
Nova – OpenStack Compute Chevron down icon Chevron up icon
Glance – OpenStack Image Service Chevron down icon Chevron up icon
Cinder – OpenStack Block Storage Chevron down icon Chevron up icon
Swift – OpenStack Object Storage Chevron down icon Chevron up icon
OpenStack Orchestration Using Heat and Ansible Chevron down icon Chevron up icon
Using OpenStack Dashboard Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(10 Ratings)
5 star 60%
4 star 20%
3 star 10%
2 star 10%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Saumik Satapathy Dec 04, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good book to start openstack. Step by strp guide to learn and master over openstack.
Amazon Verified review Amazon
Rebecca Fitzhugh Mar 03, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Regardless of whether you are a beginner or experienced with OpenStack, this book provides a plethora of information. It provides information from high level architectural decision making assistance to Ansible code. It is an excellent all-around guide that explores all facts of OpenStack. Recommend adding it to your bookshelf!
Amazon Verified review Amazon
Paolo Correnti Nov 23, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Per avere un'idea di base di cosa sia Openstack
Amazon Verified review Amazon
Stephen Beaver Feb 20, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
OpenStack Cloud Computing Cookbook is a solid guide for anyone that is starting out as well as a quick reference guide for the seasoned administrator. Whether you are just starting out and are looking for a step by step guide from deployment to operations or a reference point on a specific topic. This cookbook will be a great addition to your technical library for information all about OpenStack.
Amazon Verified review Amazon
Stefan Lenz May 21, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The cookbook always was a great resource to learn about the basics of Openstack and to set up ones own clusters. While the earlier editions were limited with respect to network topologies and production cluster setup, the new, fourth editions has made a big step forward. The presented network topology and setup recipes of the cookbook are "production grade". You learn how to build your own small production cluster that can be used for learning but also to test real workloads. Kudos to the writers for this new edition.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.