GithubHelp home page GithubHelp logo

provisioning-servers's Introduction

HW1-DevOps: Provisioning Servers

Name: Vidhisha Jaswani Unity ID: vjaswan

Digital Ocean

Documentation: Digital Ocean

  1. Create an account on Digital Ocean and generated a Personal Access Token (with both read and write access) to use the API.

  2. Set the token

# Mac/Linux
export DOTOKEN="xxx"
# Windows
setx DOTOKEN xxx
  1. Create an SSH Key on your computer using ssh-keygen . This will generate keys in the location ~/.ssh where id_rsa is the private key and id_rsa.pub is the public key. Press Enter when it asks to enter a paraphrase.

  2. Next, In your Digital Ocean account, under Security add a SSH Key. Paste the content of id_rsa.pub as the SSH key content and give the key a name.

  3. Retrieve the ID associated with your SSH key using

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $DOTOKEN" "https://api.digitalocean.com/v2/account/keys"
  1. Update the code in createDroplet function from "ssh_keys":null to "ssh_keys":[12345...] For the purpose of submission, I have removed my ID from the code.

  2. Run the following commands

mkdir HW1-DevOps-ProvisioningServers
cd HW1-DevOps-ProvisioningServers
git clone https://github.ncsu.edu/vjaswan/HW1-DevOps-ProvisioningServers
cd HW1-DevOps-ProvisioningServers/DigitalOcean
npm install
node main.js
  1. Now SSH into the droplet using the IP address and no password will be required.
ssh root@<ip-address>
  1. To delete the instance, update the Droplet ID in line 244 of main.js. Comment out line 239 and uncomment line 264.

digitalocean

AWS EC2 Instance

Documentation: Amazon EC2

Prerequisite: Python 3 version 3.3+

  1. For creating and running the instance we need AWS CLI installed. Refer this link for installation.

  2. Navigate to the folder where HW1-DevOps-ProvisioningServers/AWS and run pip install -r requirements.txt --user if you do not have boto3 installed already.

  3. Run aws configure where it will ask you to enter your Access Key ID and Secret Access Key. To get these keys refer this link

  4. Run command python main.py. This will create an instance which you can also see in your dashboard.

  5. Run the following commands to then SSH into the EC2 instance

chmod 400 aws-key.pem
ssh -i "aws-key.pem" ec2-user@<ip-address>
  1. Finally, to delete the instance run, edit line 3 in delete.py to update the Instance ID to be deleted and run python delete.py

aws

Screencast

Screencast Link

Thank you!

provisioning-servers's People

Contributors

vidhishajaswani avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.