There are two ways to create resources in Openstack, a graphical user interface by using the Horizon dashboard, and the other way is by using CLI access.
1- Create required networks and subnets:
For our example, we need one network only.
To get API access, please follow the KB Click here.
a- Creating Needed Networks:
Create the network using command:
openstack network create <NET_NAME>
copy
b- Creating Corresponding Subnets:
Create a relative subnet using command:
openstack subnet create <SUBNET_NAME> --network <NET_NAME> --subnet-range <X.X.X.X/X>
copy
Using the graphical user interface to create the needed networks and subnets.
Go to Network
copy => Networking
copy => Click on Create Network
copy
Give a network name
Give the subnet name and network address
Then click create
copy.
Repeat the above for any needed networks and subnets.
2- Creating Openstack Router:
Create a virtual router:
openstack router create <ROUTER_NAME>
copy
Add router to needed subnet:
openstack router add subnet <ROUTER_NAME_OR_ID> <SUBNET_NAME_OR_ID>
copy
Link the router to the external provider network:
openstack router set <ROUTER_NAME> --external-gateway <EXTERNAL_NETWORK_ID>
copy
Note that, external network ID for RUH2 is
c975f064-d2b8-413c-9493-981f68bf887a
copy, and for JED1 is80e37cda-1762-4d98-8e55-df3e33710295
copy
You can also use the Horizon dashboard to create the needed router.
Go to Network
copy => Routers
copy => Click on Create Router
copy
Give the Router name and click Create
copy.
Now, after creating the router, you will need to set the router as an external one, to do that just click Set Gateway
copy, then select the External Network
copy
Again click Set Gateway
copy
The next step is to add an interface to the created router from any needed subnet.
Click on the router name.
Click on Add Interface
copy
Select the Subnet
copy, and optionally you can select the IP Address.
Then click Add Interface
copy
3- Creating Security Groups:
The next step is to create a security group. You can create a security group from GUI or from CLI.
a- From CLI:
openstack security group create <SEC_GROUP_NAME> --description "Security Group"
copy
Add needed rules:
openstack security group rule create <SEC_GROUP_NAME> \
--protocol tcp --dst-port 443:443 --remote-ip 0.0.0.0/0
copy
b- From GUI:
Got to Network => Security Groups => Click Create Security Group
copy
Give the security group name and click
Create Security Group
copy
Add select HTTPS
copy
Add any additional needed rules
4- Creating an Instance:
Now, we will create an instance.
a- From CLI:
Use the following command to create the instance:
openstack server create \
--flavor <FLAVOR_NAME> --image <IMAGE_ID> --availability-zone <ZONE_NAME> --security-group default --security-group <SEC_GROUP_NAME> \
--network <NET_NAME> \
--boot-from-volume <VOLUME_SIZE> --max 1 \
--wait <SERVER_NAME>
copy
In this demo we simplify the code and used
--network
copy flag, for more advanced use cases, refer to the ‘–nic’ parameter.
b- Create the an instance from GUI:
Please follow this KB Click here