More stuff on adders and start AWS notes

This commit is contained in:
Thomas Bishop 2022-12-02 16:51:04 +00:00
parent cc3fe6d6be
commit a95d6f1ed2
7 changed files with 77 additions and 1 deletions

View file

@ -0,0 +1,22 @@
---
categories:
- DevOps
tags: [AWS]
---
# Database options
Amazon offers numerous database options however they are often named differently or are Amazon's own implementation of a certain database type:
- **Relational databases**
- Amazon offers two core RDSs: **Amazon Aurora** and **Amazon RDS**. Both allow you to use MySQL and PostgreSQL as the management implementation. The differences come down to which management implmentations are supported, number of backups and throughput. For instance Aurora has higher performance, more logging and fail-safes.
- **NoSQL**
- Document-based databases
- The obvious candidate for this kind of database is MongoDB. Amazon doesn't offer MongoDB it offers its own implementation which is almost identical and compatible with Mongo: **Amazon DocumentDB**. (There is some bitching about this from Mongo but they are competitors.)
- Key-value database
- A key-value database is basically a hash-table or a map
- The Amazon implementation of this is **DynamoDB**
- Confusingly, for NoSQL, a DynamoDB instance comprises "tables" which are groupings of keys and values. I guess "table" here is meant in terms of "hash table"
- A cool feature is that you can subscribe to a DynamoDB table and run a lambda when a value changes.

View file

14
DevOps/AWS/AWS_S3.md Normal file
View file

@ -0,0 +1,14 @@
---
categories:
- DevOps
tags: [AWS]
---
# S3
You can think of S3 as an external mounted harddrive for storing raw binary data (images, soundfiles, documents etc).
Your use of the S3 service is divided up into **buckets**. Buckets contain files and resources.
The primary use of S3 is to store resources that an application needs and/or to facilitate the uploading and downloading of resources to and from an application.
You can set access and authentication conditions for buckets, making the data public or restricted.

View file

@ -0,0 +1,35 @@
---
categories:
- DevOps
tags: [AWS]
---
# User management and roles
## IAM
> Identity and Access Management
An IAM user is an identity with long-term credentials that is used to interact with AWS in an account. An IAM login is different from a root login. The root user is the one who creates the AWS account and who has the power to delete it. The root user can create IAM logins so that other users can log in through dedicated IAM portals. The root user should also create an IAM login for himself and use that, set to administrator policies, for most activities, reserving root for the most consequential stuff like adding users etc.
## Users and user groups
- Use to create users and access rights accross the AWS services
- Users get permissions through policies (use template or create your own)
- You can also create user groups and add users to them to simplify role attribution
## Roles
Roles are adopted by _services_ rather than users. They run either periodically (from a `cronjob` say) or when they are hit from an API.
This allows you to assign policies to a role that a service can adopt when running. A good example is a lambda. Lambdas often need access to other services such as an S3 bucket or a DynamoDB table. Say you have a service that combines a lambda with a DynamoDB database. You could assign a role to the lambda and it would have access to the database.
## Cognito
> Amazon Cognito provides authentication, authorization, and user management for your web and mobile apps.
There are **user pools** and **identity pools**.
User pools provide sign-up and sign-in options for your app users. Identity pools provide AWS credentials to grant your users access to other AWS services.
You would use identity pools to manage access to API endpoints or S3 buckets. They can be authenticated or unauthenticated. For example if you want to use an image from S3 in a website you would authenticate for that, but you would explicitly have to specify that it is general access by applying the policy `AmazonS3ReadOnlyAccess`.

3
DevOps/AWS/Errata.md Normal file
View file

@ -0,0 +1,3 @@
- Investigate AWS Amplify, specifically how it relates to local development
- VSCode plugin for AWS
- VSCode plugin for Mongo

0
DevOps/Git/.gitkeep Normal file
View file

View file

@ -7,7 +7,7 @@ tags: [logic-gates, binary]
# Four-bit adder
A single [half adder](/Electronics/Digital_Circuits/Half_adder_and_full_adder.md#half-adder) and [full adder](/Electronics/Digital_Circuits/Half_adder_and_full_adder.md#full-adder) allows us to calculate the sum of two 1-bit numbers, but this is not much use in practice. To approximate what is really happening at the circuit level in computers we need to be able to add bigger binary numbers. We will demonstrate how this can be achieved for a four-bit number (nibble) using repeated full adders and half adders.
A single [half adder](/Electronics/Digital_Circuits/Half_adder_and_full_adder.md#half-adder) and [full adder](/Electronics/Digital_Circuits/Half_adder_and_full_adder.md#fufll-adder) allows us to calculate the sum of two 1-bit numbers, but this is not much use in practice. To approximate what is really happening at the circuit level in computers we need to be able to add bigger binary numbers. We will demonstrate how this can be achieved for a four-bit number (nibble) using repeated full adders and half adders.
We want to be able to calculate the following sum:
@ -22,6 +22,8 @@ We will achieve this by using three full adders and one half adder, moving from
Let's walk through the process:
![](/img/four-bit-adder.png)
1. HA receives the bits $0$ and $1$ as inputs. It outputs $1$ as the sum bit and $0$ as the carry-out.
2. FA1 receives $0$ as the carry-in bit plus $1$ and $1$ as its input. This means it has the following calculation to execute: $1 + 1 + 0$. This gives $0$ as the sum bit and $1$ as the carry-out bit.
3. FA2 receives $1$ as the carry-in (the carry-out from FA1) plus $0$ and $0$ as its own inputs. $0 + 0 + 1$ gives us $1$ as the sum bit and $0$ as the carry-out.