OpenStack
OpenStack is open source platform for virtual machines, containers and bare metal. Being free is the main driver why organizations use OpenStack.
Developers
▼
OpenStack API
▼
Programmable Network
▼
Compute and Storage Resources
Historically 50% of Fortune 100 companies run OpenStack in some form. AWS, Azure and GCP are reducing this share though, but 700+ organizations in total.
OpenStack is a collection of 60 open source projects. Pick-and-choose what you need.
OpenStack projects translated to AWS:
Keystone => IAM
Horizon => AWS Management Console
Heat => CloudFormation
Ceilometer/Gnocci => CloudWatch
Nova => EC2
Glance => AIM for EC2
Cinder => Block Storage for EC2
Neutron => VPC
Swift => S3
Trove => RDS
MagnetoDB => DynamoDB
Zaqar => SQS
Mistral => SWF
Magnum => EC2 Container Service
How OpenStack services work:
User
▲
▼ (REST API)
API[Command]
▲
▼ (Message Queue)
Scheduler[PlacementRequest]
▲
▼ (Message Queue)
Service[PlacementDecision]
▲
▼ (Database)
Driver/Plugin
▲
▼
Provider[Compute/Network/Storage]
Avoid installing OpenStack manually. Just use one of the various Linux distributions that have it.
Managed OpenStack is an option if you have a small operations team. Platform9, Cisco Metacloud, IBM Bluemix, Mirantis, Ubuntu BootStack, ZeroStack
You should use OpenStack through the API.
pip install python-openstackclient
# there are also some more specific clients:
# python-keystoneclient python-novaclient python-glanceclient python-neutronclient
Command-line usage:
openstack keypair create test > test.pem
openstack image list
openstack flavor list
openstack server create --flavor <flavor> --image <image id> --key-name <key name> <name for machine>
openstack server list
# adding a public IP
openstack floating ip create public
openstack server add floating ip <server> <address>
# security group
openstack security group create <name>
openstack security group rule create --proto icmp --src-ip <source> --dst-port 0 <name>
openstack security group rule create --proto tcp --src-ip <source> --dst-port 22 <name>
openstack server add security group <server> <name>
# create an image
openstack server stop <name of vm>
openstack server image create --name <name of snapshot to create> <name of vm>
openstack server start <name of vm>
Swift
OpenStack Swift is a highly available, distributed, eventually consistent object store, like AWS S3. You essentially download and upload files or metadata.
You use Swift with an authentication token you get by presenting your credentials. The token is send by X-Auth-Token
header. These tokens will expire after a time period defined by the auth service.
Hierarchy and resource path are simple: Account > Container > Object
.
/v1/{account}/{container}/{object}
/v1/12345678912345/images/flowers/rose.jpg # notice that object name has /
Different OpenStack hosts will offer different features.
# find out what your storage provider has enabled
curl https://storage.example.com/info
Do not use uppercase characters in the names of containers or buckets. This might break things.
It's better to store a few large objects than a lot of small objects. Large objects provide more performance.
Heat Templates
Heat Orchestration Template (HOT) is a template format supported by the OpenStack Heat, along with the other template format, i.e. the Heat CloudFormation-compatible format (CFN)
# use heat template 2016-10-14
openstack stack create -t /path/to/my/stack.yml my-heat-stack
openstack stack list
heat_template_version: 2015-10-15
description: >
Simple template to deploy
a single instance in cPouta
resources:
instance0:
type: OS::Nova::Server
properties:
image: Ubuntu-16.04
flavor: standard.tiny
key_name: my-key
instance1:
type: OS::Nova::Server
properties:
image: CentOS-7
flavor: standard.small
key_name: my-key
outputs:
server_networks:
description: >
Outputs the networks of the
deployed server
value: { get_attr: [instance0, networks] }
Sources
- OpenStack Documentation