{ "metadata": { "name": "Deploy ADSC by Simple Azure" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": "# Deploying a community image, Azure Data Science Core\n\nOnce you have a virtual machine image registered on your storage account, deploying the image is simple. \nLet's see how it works in Simple Azure." }, { "cell_type": "markdown", "metadata": {}, "source": "## Load Simple Azure\nDon't forget to load simple azure first." }, { "cell_type": "code", "collapsed": false, "input": "from simpleazure import SimpleAzure as saz", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 15 }, { "cell_type": "code", "collapsed": false, "input": "azure = saz()\nazure.asm.get_config()", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 16 }, { "cell_type": "markdown", "metadata": {}, "source": "## Search a registered os image\nYou can choose an os image from the image repository to deploy a virtual machine with the image. \nHere, we want to deploy Azure Data Science Core and ``get_registered_image()`` helps find an image with a name or a label." }, { "cell_type": "code", "collapsed": false, "input": "q = azure.asm.get_registered_image(name=\"Azure-Data-Science-Core\")", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 17 }, { "cell_type": "code", "collapsed": false, "input": "vars(q)", "language": "python", "metadata": {}, "outputs": [ { "output_type": "pyout", "prompt_number": 66, "text": "{'affinity_group': u'',\n 'category': u'User',\n 'description': u'{\"description\":\"A special version of HPC Linux is now available as a Windows Azure virtual machine image. Based on OpenSUSE 12.3, this image includes all the packages you need for big data and data science computations including:\\\\r\\\\n - iPython\\\\r\\\\n - NumPy\\\\r\\\\n - SciPy\\\\r\\\\n - pandas\\\\r\\\\n - SymPy\\\\r\\\\n - scikit-learn\\\\r\\\\n - scikit-image\\\\r\\\\n - StatsModels\\\\r\\\\n - matplotlib\\\\r\\\\n - PyTables\\\\r\\\\n - NetworkX\\\\r\\\\n - Cython\\\\r\\\\n - NLTK \\\\r\\\\n\\\\r\\\\nThis image has been specially customized for Windows Azure, so it includes the Windows Azure Agent for Linux and the Azure SDK for Python. Together, these packages give you easy access to Windows Azure\\'s storage and queue services directly from iPython.\",\"publisherUrl\":\"http://vmdepot.msopentech.com/User/Show?user=2464\",\"publisher\":\"John C Linford\",\"imageUrl\":\"http://vmdepot.msopentech.com/Vhd/Show?VhdID=2440&version=2471\",\"icons\":{\"ExtraLarge\":\"https://vmdepotwestus.blob.core.windows.net/images/2464/0bde9e27-36a6-4355-87b6-6808699424d9_215x215.png\",\"Large\":\"https://vmdepotwestus.blob.core.windows.net/images/2464/0bde9e27-36a6-4355-87b6-6808699424d9_100x100.png\",\"Small\":\"https://vmdepotwestus.blob.core.windows.net/images/2464/0bde9e27-36a6-4355-87b6-6808699424d9_45x45.png\"}}',\n 'eula': u'http://www.hpclinux.com/azure',\n 'label': u'Azure-Data-Science-Core',\n 'location': u'West Europe',\n 'logical_size_in_gb': 12,\n 'media_link': u'http://communitytest.blob.core.windows.net/communityimages/community-2464-3ff1336d-e5d8-4485-9d37-fe0634ec18a7-1.vhd',\n 'name': u'Azure-Data-Science-Core',\n 'os': u'Linux'}" } ], "prompt_number": 66 }, { "cell_type": "markdown", "metadata": {}, "source": "## Specify an image to deploy\nIt seems you found a right image from the repository above. Next, you need to set the image to deploy." }, { "cell_type": "code", "collapsed": false, "input": "azure.asm.set_image(image=q)", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": "vars(a)", "language": "python", "metadata": {}, "outputs": [ { "output_type": "pyout", "prompt_number": 8, "text": "{'cert': ,\n 'certificate_path': '/home/azureuser/.azure/managementCertificate.pem',\n 'image': ,\n 'image_name': u'Azure-Data-Science-Core',\n 'location': 'Central US',\n 'name': 'sazvm-41365',\n 'os_name': u'Linux',\n 'sms': ,\n 'subscription_id': u'a6ca42fe-74c7-43e9-a441-0ab9906441da'}" } ], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": "## Region\nSome images are restricted to deploy in a certain location due to its availability. \nHere, you can see the Azure Data Science Core is only registered in ``West Europe``." }, { "cell_type": "code", "collapsed": false, "input": "azure.asm.set_location(\"West Europe\")", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": "## Ready to deploy\nYou are all set, now. Simply call the ``create_vm()`` or ``create_cluster()`` function to deploy the selected image, Azure Data Science Core." }, { "cell_type": "code", "collapsed": false, "input": "azure.asm.create_vm()", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": "azure.asm.create_cluster(num=5)", "language": "python", "metadata": {}, "outputs": [], "prompt_number": 66 } ], "metadata": {} } ] }