Giter Club home page Giter Club logo

pulumi-protodev's Introduction

AWS Infrastructure Deployed with Pulumi

This repository contains a project using Pulumi to build and deploy cloud applications and infrastructure (Infra-as-Code).

Server using Amazon EC2

This project deploys a simple AWS EC2 VM running a Python web server.

Deploying the App

To deploy your infrastructure, follow the below steps.

Prerequisites

  1. Install Pulumi
  2. Configure AWS Credentials

Install Pulumi

After installing Pulumi, since we're using TypeScript, switch to Node.js 12.x LTS and verify pulumi CLI.

nvm use lts/*
pulumi version

Configure AWS Credentials

vim ~/.aws/config

# Set AWS region for this profile, which is ap-northeast-2
export AWS_PROFILE=pel

Steps

After cloning this repo, from this working directory, run these commands:

  1. Set the required configuration variables for this program:
$ pulumi config set aws:region ap-northeast-2
  1. Stand up the VM, which will also boot up your Python web server on port 80:
$ pulumi up
  1. After a couple minutes, your VM will be ready, and two stack outputs are printed:
$ pulumi stack output
Current stack outputs (2):
OUTPUT          VALUE
publicIp        NN.NN.NNN.NN
  1. Thanks to the security group making port 80 accessible to the 0.0.0.0/0 CIDR block, we can curl it:
$ curl $(pulumi stack output publicIp)
Hello, World!
  1. From there, feel free to experiment. Simply making edits and running pulumi up will incrementally update your VM.

  2. If you need to connect to the VM remotely using SSH, add SSH key into instance.

Go to AWS Console and "Connect" to the instance. Pick "EC2 Instance Connect (browser-based SSH connection)". Once you're in, do:

# Follow guide: https://stackoverflow.com/questions/3260739/add-keypair-to-existing-ec2-instance

ubuntu@ip-1-1:~$ sudo adduser pel
New password: *****************

$ ssh-keygen -t rsa -b 4096 -C "pel@protodev"
  1. Afterwards, destroy your stack and remove it:
$ pulumi destroy --yes
$ pulumi stack rm --yes

pulumi-protodev's People

Contributors

cedrickchee avatar

Watchers

 avatar  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.