Installing the Cdev Sdk

The Cdev Sdk is currently distributed as a Python Package with PyPi, so you can install it using a single command with pip.

Python Virtual Environments
It is consider a Python development best practice to always work with a python virtual environment. The virtual environment will help you avoid dependency conflicts when working with multiple projects.

Installing the SDK

pip install cdev

Once you have installed the package, the CLI tool should be available to your environment. You can check that the tool has properly installed by running the following command.

cdev -h

Create Your First Project

Artifacts S3 Bucket

When creating a new project, you will be prompted to link to a S3 Bucket for your deployment artifacts. This bucket will be used internally by Cdev to help manage your deployment artifacts.

If you have S3 Buckets in your AWS account, you will be prompted to select which bucket to use. If no bucket is present in the account, you will be prompted to create one.

The same bucket can be used for managing the deployment artifacts for multiple projects.


Now that we have the Cdev Sdk installed, we can use it to create a new Project.

cdev init demo-project

Template Project
By default, Cdev will create your project with some boilerplate files setup to help you get started faster.

Deploying Resources

Cdev helps developers manage and deploy the changes to their Project onto the Cloud. You can use the plan command to check the current set of changes that would be deployed in the Cloud based on the changes you have made to your Project. Since we have not deployed anything in the Cloud for this Project, it will show that we want to create the resources defined in the src/resources.py file: an API and Serverless Function.

cdev plan

When you are ready to deploy your changes, you can use the deploy command to deploy the changes. You will be prompted to confirm the set of changes that you are about to deploy. Note that Cdev will use the currently configured Aws credentials for your environment to deploy the resources

cdev deploy

Testing Serverless Function

Now that we have deployed our Serverless Function and API, we can test that they have been created in the Cloud. We can execute our function in the Cloud and then retrieve the logs of the Serverless Function.

cdev run function.execute hello_world_comp.hello_world_function

You might have to wait a sec for the logs to process in the cloud

cdev run function.logs hello_world_comp.hello_world_function

Test API Endpoint

We can also check that our API has been properly created and configured with our Serverless Function. We can use the Output command to get the url that the Cloud generated for our API.

cdev output hello_world_comp.api.demoapi.endpoint

outputs

<your-url>

We can now use the curl cli tool to call our API Endpoint or visit <your-url>/hello_world directly in your web browser!

curl <your-url>/hello_world

Clean Up

We can delete all the created resources using the destroy command.

cdev destroy

Next Steps

Now that you have created and deployed your first API and Serverless Function, you can follow one of our tutorials to learn how to create a larger project.