Skip to content

Latest commit

 

History

History
79 lines (62 loc) · 4.5 KB

File metadata and controls

79 lines (62 loc) · 4.5 KB

Week 0 — Billing and Architecture :

Conceptual Diagram :

image

Here's a link to share on Lucid Chart

Logical Architecture :

image

Creation of IAM admin usage with access key :

image

Installing AWS CLI using our GitPod account :

From within my GitPod terminal, i did the following:

  1. curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" ==> download the binary files & save it as awscliv2.zip
  2. unzip awscliv2.zip
  3. sudo ./aws/install

Configure User Credentials to use CloudShell :

To configure User Credentials via the CLI, i Change the values and export at the terminal link this :

export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_DEFAULT_REGION=us-east-1

Then, to verify if it's work, we can do aws sts get-caller-identity : image

GitPod configuration :

To avoid having to reconfigure our environment variables every time Gitpod was launched, we made sure to save them in the software configuration. To do this, we use the script from Andrew Brown's repo which aws-cli is installed and set the cli prompt to auto-complete :

tasks:
  - name: aws-cli
    env:
      AWS_CLI_AUTO_PROMPT: on-partial
    init: |
      cd /workspace
      curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
      unzip awscliv2.zip
      sudo ./aws/install
      cd $THEIA_WORKSPACE_ROOT

Then, to persist update on cloud environment : gp env <AWS_ENV_VARIABLE>=<AWS_VALUE>

image

Create Budget with notifications :

To create Budget via AWS CLI, we based ourselves on the CLI Documentation

We persist the Account ID variable using: gp env AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text). After creating the respective json files for the budget and notification, you can run this command in terminal:

  aws budgets create-budget \
    --account-id $AWS_ACCOUNT_ID \
    --budget file://aws/json/budget.json \
    --notifications-with-subscribers file://aws/json/budget-notifications-with-subscribers.json

image

Create SNS Topic :

To create a topic, use aws sns create-topic --name evebootcamp-billing-alarm. You must then register to receive a notification. To subscribe, use:

aws sns subscribe \
    --topic-arn="arn:aws:sns:us-east-1:<your_acct_id>:<your_topic_name>" \
    --protocol=email \
    [email protected]

image

image

Creating a Billing Alarm :

Using this json file, we will be updating the arn section. Then, do the aws cloudwatch put-metric-alarm --cli-input-json file://aws/json/alarm_config.json command to set up the alarm :

image

image