Code Monkey home page Code Monkey logo

aws_demo's Introduction

Creating a SSH Key Pair.

In order to have an SSH session with the servers from task 2 without using Session Manager, it is necessary to have a key pair in the region and pass its name to the deploy.sh script. If you don't have a key configured, use the script create_ssh_key.sh to generate one.

make gen-ssh-key

The script will create a SSH Key pair in the desired region that can be configured using environment variables

Optional Environment Variables

Environment variables can be used to pass parameters to the script

  • AWS_REGION: Region to deploy the key pair - Default: 'eu-west-2'
  • SSH_KEY_NAME: Name to use in Key creation - Default: 'code-key'

#Changing key name and AWS Region AWS_REGION='eu-west-1' SSH_KEY_NAME='other-key-name'./create_ssh_key.sh

Deploying the solution

This Project has a deploy.sh script, that will perform the following actions:

make deploy

Optional Environment Variables

Environment variables can be used to pass parameters to the script

  • AWS_REGION: Region to deploy the solution - Default: 'eu-west-2'

  • DB_INSTANCE_TYPE: Instance type to be used by RDS - Default: 'db.t3.micro'

  • DEV_PUBLIC_IP - Default: Automatically gets public IP from Machine running deploy.sh

  • INSTANCE_TYPE- Instance type to be used by servers from task 2 - Default: 't3.micro'

  • OWNER: Stack Owner, value will be used in R53 Domain and S3 Bucket - Default: 'someone'

  • DOMAIN_NAME: Domain that will be used to create the Bucket and HostedZone - Default: '${OWNER]-${AWS_REGION}-somechallenge.com'

  • NETWORK_Name: Name of Stack containing core network resources - Default: 'network'

  • COMPUTE_name: Name of Stack containing Compute resources - Default: 'compute'

  • PERSISTENCE_Name: Name of Stack containing Persistence resources- Default: 'persistence'

  • SSH_KEY_NAME: Name from SSH key - Default: none

  • To get running Instances IP Address:

AWS_REGION='eu-west-2'
COMPUTE_name='compute'

aws ec2 describe-instances \
    --filters "Name=tag:aws:cloudformation:stack-name,Values=${COMPUTE_name}" \
    --region "${AWS_REGION}" | jq -r ".Reservations[].Instances[].PublicIpAddress"

The credentials for the database are created automatically by AWS and they are stored in SecretsManager, under the following secret name: Secret

Get Domain Name used to deploy HostedZone

  • Get DB Credentials
AWS_REGION='eu-west-2'
aws secretsmanager get-secret-value --region "${AWS_REGION}" --secret-id Secret | jq -r ".SecretString"

Using psql

amazon-linux-extras install postgresql13 -y PGPASSWORD=<DB_password> psql -h -p -U <DB_Username> demodb

## Deleting Solution Resources

```bash
make cleanup

aws_demo's People

Contributors

fredfrazao avatar

Stargazers

 avatar

Watchers

 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.