Code Monkey home page Code Monkey logo

pulumi-aws-py-fargate-example's Introduction

Pulumi project in Python to deploy NGINX webserver in containers using AWS ECS Fargate

Prerequisites

  • Install Pulumi

  • Configure Pulumi to Use AWS (if your AWS CLI is configured, no further changes are required)

  • Clone repo and run the following commands

    git clone https://github.com/sciciliani/pulumi-aws-py-fargate-example
    cd pulumi-aws-py-fargate-example
    pulumi stack init dev
    pulumi config set aws:region us-east-1 # any valid AWS region will work
    python3 -m venv venv
    source venv/bin/activate
    pip3 install -r requirements.txt

Running the Example

  1. Deploy everything with a single pulumi up command.

    $ pulumi up

    After being prompted and selecting "yes", your deployment will begin. It'll complete in a few minutes:

    Updating (dev):
         Type                             Name                Status
     +   pulumi:pulumi:Stack              aws-py-fargate-dev  created     
     +   ├─ aws:iam:Role                  task-exec-role      created     
     +   ├─ aws:ec2:Vpc                   main                created     
     +   ├─ aws:ecs:Cluster               cluster             created     
     +   ├─ aws:ecs:TaskDefinition        app-task            created     
     +   ├─ aws:iam:RolePolicyAttachment  task-exec-policy    created     
     +   ├─ aws:ec2:InternetGateway       ig-main             created     
     +   ├─ aws:ec2:Subnet                subnet-a            created     
     +   ├─ aws:ec2:Subnet                subnet-b            created     
     +   ├─ aws:ec2:SecurityGroup         public-web          created     
     +   ├─ aws:lb:TargetGroup            app-tg              created     
     +   ├─ aws:ec2:Route                 inet-route          created     
     +   ├─ aws:lb:LoadBalancer           app-lb              created     
     +   ├─ aws:lb:Listener               web                 created     
     +   └─ aws:ecs:Service               app-svc             created     
    
    Outputs:
        url: "app-lb-ad43707-1433933240.us-west-2.elb.amazonaws.com"
    
    Resources:
        + 15 created
    
    Duration: 2m56s
    

    Notice that the automatically assigned load-balancer URL is printed as a stack output.

  2. Open a browser to the output url. In example: app-lb-ad43707-1433933240.us-west-2.elb.amazonaws.com

  3. Once you are done, you can destroy all of the resources, and the stack:

    $ pulumi destroy
    $ pulumi stack rm

pulumi-aws-py-fargate-example's People

Contributors

bieli avatar sciciliani avatar

Stargazers

 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.