Skip to content

Instantly share code, notes, and snippets.

@harrythebarry
Last active March 7, 2020 10:21
Show Gist options
  • Save harrythebarry/852e8e40d2c0bf16eede3143db07c055 to your computer and use it in GitHub Desktop.
Save harrythebarry/852e8e40d2c0bf16eede3143db07c055 to your computer and use it in GitHub Desktop.

Revisions

  1. harrythebarry revised this gist Mar 7, 2020. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -76,3 +76,10 @@ http.get('http://18.217.220.5:8081', (resp) => {
    console.log("Error: " + err.message);
    });


    # IAM permissions
    - Using ENV Variables of User
    - Using AWS credentials inside application
    - Passing AWS credentials dynamically to application
    - Attach role to EC2 instane on which application is running

  2. harrythebarry revised this gist Mar 7, 2020. 1 changed file with 26 additions and 0 deletions.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -50,3 +50,29 @@ http.createServer(function (request, response) {

    // Console will print the message
    console.log('Server running at http://127.0.0.1:8081/');


    #### Talk to another server..

    const http = require('http');

    //load with local ip
    //http.get('http://172.31.36.226:8081', (resp) => {
    http.get('http://18.217.220.5:8081', (resp) => {

    let data = '';

    // A chunk of data has been recieved.
    resp.on('data', (chunk) => {
    data += chunk;
    });

    // The whole response has been received. Print out the result.
    resp.on('end', () => {
    console.log(data);
    });

    }).on("error", (err) => {
    console.log("Error: " + err.message);
    });

  3. harrythebarry revised this gist Mar 7, 2020. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -31,4 +31,22 @@ nvm install node
    export AWS_DEFAULT_REGION=us-east-1
    export AWS__REGION=us-east-1
    export AWS_ACCESS_KEY_ID=<ACCESS_ID>
    export AWS_SECRET_ACCESS_KEY=<SECRET_ACCESS_KEY>
    export AWS_SECRET_ACCESS_KEY=<SECRET_ACCESS_KEY>



    # Start node server
    var http = require("http");

    http.createServer(function (request, response) {
    // Send the HTTP header
    // HTTP Status: 200 : OK
    // Content Type: text/plain
    response.writeHead(200, {'Content-Type': 'text/plain'});

    // Send the response body as "Hello World"
    response.end('Hello World\n');
    }).listen(8081);

    // Console will print the message
    console.log('Server running at http://127.0.0.1:8081/');
  4. harrythebarry revised this gist Mar 7, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -30,5 +30,5 @@ nvm install node

    export AWS_DEFAULT_REGION=us-east-1
    export AWS__REGION=us-east-1
    export AWS_ACCESS_KEY_ID=<ACCESS_KEY>
    export AWS_SECRET_ACCESS_KEY=OsAGhw99uaPycjBWMxQRlYJoPnqg8AipdFAo2j0x
    export AWS_ACCESS_KEY_ID=<ACCESS_ID>
    export AWS_SECRET_ACCESS_KEY=<SECRET_ACCESS_KEY>
  5. harrythebarry revised this gist Mar 7, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -26,3 +26,9 @@ nvm install node
    # TODO
    - Create User and provide programmatic & console access
    - Attach Admin Policy
    - Download

    export AWS_DEFAULT_REGION=us-east-1
    export AWS__REGION=us-east-1
    export AWS_ACCESS_KEY_ID=<ACCESS_KEY>
    export AWS_SECRET_ACCESS_KEY=OsAGhw99uaPycjBWMxQRlYJoPnqg8AipdFAo2j0x
  6. harrythebarry created this gist Mar 7, 2020.
    28 changes: 28 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    ## Setup
    * Create VPC
    * Create 2 Subnets under it
    * Connect both subnets to same routing table
    * Add Internetgateway to routing table
    * Connect EC2 to one of the subnets
    * Start instance and connect


    ## Install node on ec2 instance
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
    . ~/.nvm/nvm.sh
    nvm install node

    # Check node



    #
    * IAM
    - Roles & Policies
    - Users & Groups
    - Access Type - Programmatic & Console
    - User will be in a Group and also given Role or attached with some policies

    # TODO
    - Create User and provide programmatic & console access
    - Attach Admin Policy