week 6 Flashcards
AWS regions & availability zones
- spans 77 Availability Zones within 24 geographic regions around the world,
- AWS Regions: geographical location with a collection of availability zones mapped to physical data centers in that region
- AWS Availability Zones: logical data center in a region available for use by any AWS customer
EC2 autoscaling
helps you maintain application availability and allows you to automatically add or remove EC2 instances according to conditions you define
benefits:
- Improve Fault Tolerance
- Increase Application Availability
- Lower Costs
groups: collections of EC2 instances with similar charcteristics
launch configuration: template used by auto scaling group to launch EC2 instances
Git flow & Branching
branching: a reference to commit, branch itself represents the HEAD of a series of commits
- default branch name in Git is master, which commonly represents the official, working version of your project
- a strategy that allows developers to take a snapshot of the master branch and test a new feature without corrupting the project in production. If the tests are successful, that feature can be merged back to the master branch and pushed to production.
virtual machines
simulate a physical server so that multiple “servers” can run on a single machine
Pros:
near total isolation
Provides virtualization, virtualizing the entire OS
Ensures an application runs reliably regardless of Host
Cons:
considered “bulky”, expensive in the context of resources
containers
bundle together applications with their supporting libraries and dependencies, allowing them to run isolated from one another
Pros:
- considered “light weight”, because they don’t require spinning up a whole guest OS
- they can enable layers of isolation or partial isolation– depending on how they are implemented
- provide a virtualized view of certain resources.
- Package an application in an isolated environment
- Ensure an application runs reliably regardless of Host
Cons:
- having layers of isolation
- if you have need of very strict and complete isolation the ability to have layers can be a con
containerization
helps to ensure the application or set of processes can run reliably regardless of the host environment
managing containers
- list containers
- run command in running container
- view container logs
- list port mappings between containers ports and hosts
- stop a container
- pause and unpause container
- start container
- remove container
- remove volume
docker architecture
- Docker CLI (Command Line Interface) client: what Docker developers typically use for interactions with the Docker daemon, prefaced by the docker command
- Docker Daemon: long running process on the docker host that does all the heavy lifting of managing Docker objects- containers, images, etc.
- Rest API: underlying commands used by the CLI and other applications to interact with the Docker Daemon
- Docker registries: provide a centralized place to store images, allowing you to easily share images between docker hosts.
- Docker objects: are managed by the docker daemon. include images and containers. Images are the templates that outline all dependencies for a particular container and it’s primary process. Meanwhile the container is the runnable instance of a set of processes and their dependencies.
dockerfile
Defines everything needed for an image. It outlines the starting point, dependencies and commands that make up all the processes needed for an image and in turn a container.
docker volumes
a way to persist data for a container
They facillitate:
- sharing data between many different containers
- decoupling of host and container
- storing data remotely
- moving data between hosts or backing up data between hosts
docker best practices
- lightweight containers and images
- less in working directory means faster the process and lighterweight the image
- least number of ultimate layers for an image possible
- use volumes for persistent data
- use secrets for sensitive data and config files for configurations that are not sensitive
dockerfile commands
FROM image name: specifies the parent image from which the new image should be based
RUN: used to set up image
ADD : adds files from build context or url to the image
COPY : adds files from the build context to the image
EXPOSE: outlines the ports that the are being listened on by processes in the container
VOLUME [“/nameofdir”]: indicates what directory to connect a volume to when running the docker container
WORKDIR : sets the working directory in the image and eventual container of commands that follow
CMD: used to run the app, processes etc. needed inside of your container
building an image
create image with build: “> docker build anyflags PATH”
create image with commit: “> docker commit flags CONTAINER imagename”
image management: “docker images”
creating containers
> docker create imagename - creates a container that is in the “created” state
docker run flags imagename - pulls the image from the registry, then creates and runs the container
docker compose
the tool that makes creating and managing multi-container applications easier.
file components: version services: image, build, ports, environment, env_file, restart volumes networks