// Module included in the following assemblies:
//
// assembly-iot-guide.adoc
// assembly-IoT.adoc

[id='iot-creating-project-{context}']
= Creating an IoT project

After installing the IoT services, you create an IoT project.

.Prerequisites
* link:{BookUrlBase}{BaseProductVersion}{BookNameUrl}#installing-services-messaging-iot[The IoT services are installed].

.Procedure

ifeval::["{cmdcli}" == "oc"]
. Log in as a messaging tenant:
+
[subs="attributes",options="nowrap"]
----
{cmdcli} login -u developer
----
endif::[]

. Create a _managed_ IoT project:
+
[options="nowrap",subs="attributes"]
----
ifeval::["{cmdcli}" == "oc"]
{cmdcli} new-project myapp
endif::[]
ifeval::["{cmdcli}" == "kubectl"]
{cmdcli} create namespace myapp
kubectl config set-context $(kubectl config current-context) --namespace=myapp
endif::[]
{cmdcli} create -f install/components/iot/examples/iot-project-managed.yaml
----

. Wait for the resources to be ready:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} get addressspace iot
{cmdcli} get iotproject iot
----
NOTE: Make sure that the `Phase` field shows `Ready` status for both resources.

. Create a messaging consumer user:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} create -f install/components/iot/examples/iot-user.yaml
----

