Giter VIP home page Giter VIP logo

beep-infrastructure's Introduction

Beep Infrastructure

Beep infrastructure is defined and managed using the AWS CDK.

Installation

Prerequisites

CDK

npm install -g aws-cdk
npm install

Deployment

Always consult with your local AWS specialist before deployment, if you are unsure of what you are doing.

Prerequisites

Before deploying the stack for the first time, there must be a hosted zone present in route 53. This hosted zone must manage the domain name that you pass to the BeepStack constructor in beep-infrastructure.ts:

new BeepStack(app, 'Beep', {
  env: {
    account: 'xxxxxxxxxxxx',
    region: 'eu-west-1'
  },
  domainName: 'stichtingbeep.nl',
});

If you have recently created this hosted zone, you should wait 24-48 hours for the DNS records to properly propagate, before you deploy the stack for the first time (or change the domain name). If you do not do this, the certificate generation process will fail, because this process uses DNS validation to automatically validate requested certificates.

For email sending, you must have an active SES configuration. In the cognito file you must add the correct ARN for the from address.

Initial deployment

When you deploy the stack for the first time, make sure to set the desired service count to 0, because the images do not yet exist.

Production

Before you deploy the updated app, evaluate the difference between the AWS CDK app and the deployed app:

cdk diff

Deploy the changes:

cdk deploy Beep*

Development

Use the reference documentation to get an understanding of the concepts.

Debugging

In order to debug, add a Run/debug configuration in WebStorm:

Run > Edit Configurations...

Under Javascript file add the path to your CDK binary e.g. ~/.nvm/versions/node/v12.7.0/bin/cdk.

Under Application parameters add the CDK command you want to debug for, e.g. diff

Name the command after the CDK command you want to debug e.g. cdk diff.

If you are using a specific profile, do not forget to add the --profile argument with the profile name.

Set a breakpoint and click debug next to the run configuration in the top right.

Connecting to the database (RDS)

  1. Install the Session Manager Plugin Plugin for AWS CLI
  2. Log into the bastion instance: aws ssm start-session --target i-096eca4a81f445b75
  3. Assume the ec2-user:
    $ sudo -i
    # su ec2-user
    
  4. Add your own public key to the authorized_keys file of the ec2-user
  5. Add the following to your ssh config
    Host i-* mi-*
      ProxyCommand sh -c "PATH=$PATH:/usr/local/bin /usr/local/bin/aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
    
    Note If you are using a different profile in aws, make sure to include the --profile argument

The PATH=$PATH:/usr/local/bin in front of the command is necessary if you use Sequel Pro (Mac). For some reason it doesn't respect the user paths and fails to find aws cli and session plugin

beep-infrastructure's People

Contributors

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