Friday, September 29, 2017

AWS notes


Blogs:

AWS docs:



You create an AMI from an "instance" and a snapshot from a "volume". You can create a snapshot of any EBS volume at any time, and the running state of the machine will never be affected. All caveats about a snapshot of an active volume apply.

When I create AMIs from my Windows instances they are always restarted; I'm not sure why that is so. They do not seem to be "stopped" then "started" since I never lose the Elastic IP association to the instance. I have read, though I have no personal experience, that Linux instances are NOT restarted during AMI creation.

There are a couple different methods of backing up instance data. Snapshotting EBS volumes will not reboot an instance or make it inaccessible. That being said, while the snapshot is in progress it is possible to notice performance degradation. We typically recommend customers stop doing read/writes (especially database read/writes) to a volume while it is being snapshotted to ensure data consistence. Details on creating an EBS snapshot are available here: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html

Another option is to create an EBS AMI. An AMI (Amazon Machine Image) by default will snapshot all attached EBS volumes and create a "one click" method of launching new instances. This process WILL reboot the instance. It is possible if you are using the CLI, to leverage the --no reboot flag. Though this isn't recommended, it is an option. Further details on creating an EBS AMI are available here: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/Tutorial_CreateImage.html
========
Get Screenshots of console: EC2 console https://console.aws.amazon.com/ec2/.
  1. Left Navigation Pane, choose Instances
  2. Select instance
  3. Actions - > Instance Settings -> Get Instance Screenshot
Create snapshot of EC2:

  1. AWS EC2 console -> INSTANCES -> Instances
  2. From the instance property in lower right panel, click on the "Root device" name and write down the EBS ID, "vol-..."
  3. WS EC2 console -> ELASTIC BLOCK STORE -> Snapshots -> Create Snapshot, fill in the form with EBS ID
Restore snapshot:
  1. create volume from snapshot
  2. if root vol, detach the old volume. Attach the new vol as /dev/sda1




====
Storage: EC2 Instance Store, EBS, EFS, S3


AWS Storage Overview

Amazon Simple Storage Service
(Amazon S3)
A service that provides scalable and highly durable object storage in the cloud.
Amazon Glacier A service that provides low-cost highly durable archive storage in the cloud.
Amazon Elastic File System
(Amazon EFS)
A service that provides scalable network file storage for Amazon EC2 instances.
Amazon Elastic Block Store
(Amazon EBS)
A service that provides block storage volumes for Amazon EC2 instances.
Amazon EC2 Instance Storage Temporary block storage volumes for Amazon EC2 instances.
AWS Storage Gateway An on-premises storage appliance that integrates with cloud storage.
AWS Snowball A service that transports large amounts of data to and from the cloud.
Amazon CloudFront A service that provides a global content delivery network (CDN).

Storage Need
Solution
AWS Services
File system
Amazon S3 uses a flat namespace and isn’t meant to serve as a standalone, POSIX-compliant file system. Instead, consider using Amazon EFS as a file system.
Amazon EFS
Structured data with query
Amazon S3 doesn’t offer query capabilities to retrieve specific objects. When you use Amazon S3 you need to know the exact bucket name and key for the files you want to retrieve from the service. Amazon S3 can’t be used as a database or search engine by itself. Instead, you can pair Amazon S3 with Amazon DynamoDB, Amazon CloudSearch, or Amazon Relational Database Service (Amazon RDS) to index and query metadata about Amazon S3 buckets and objects.
Amazon DynamoDB Amazon RDS Amazon CloudSearch
Rapidly changing data
Data that must be updated very frequently might be better served by storage solutions that take into account read and write latencies, such as Amazon EBS volumes, Amazon RDS, Amazon DynamoDB, Amazon EFS, or relational databases running on Amazon EC2.
Amazon EBS
Amazon EFS Amazon DynamoDB Amazon RDS
Amazon EC2
Archival data
Data that requires encrypted archival storage with infrequent read access with a long recovery time objective (RTO) can be stored in Amazon Glacier more cost-effectively.
Amazon Glacier
Dynamic website hosting
Although Amazon S3 is ideal for static content websites, dynamic websites that depend on database interaction or use server-side scripting should be hosted on Amazon EC2 or Amazon EFS.
Amazon EC2
Amazon EFS
Immediate access
Data stored in Amazon Glacier is not available immediately. Retrieval jobs typically require 3–5 hours to complete, so if you need immediate access to your object data, Amazon S3 is a better choice.
Amazon S3

Relational database storage
In most cases, relational databases require storage that is mounted, accessed, and locked by a single node (EC2 instance, etc.). When running relational databases on AWS, look at leveraging Amazon RDS or Amazon EC2 with Amazon EBS PIOPS volumes.

In most cases, relational databases require storage that persists beyond the lifetime of a single EC2 instance, making EBS volumes the natural choice.
Amazon RDS Amazon EC2 Amazon EBS
Temporary storage
Consider using local instance store volumes for needs such as scratch disks, buffers, queues, and caches.
Amazon EC2 Local Instance Store
Multi-instance storage
Amazon EBS volumes can only be attached to one EC2 instance at a time. If you need multiple EC2 instances accessing volume data at the same time, consider using Amazon EFS as a file system.
Amazon EFS
Highly durable storage
If you need very highly durable storage, use S3 or Amazon EFS. Amazon S3 Standard storage is designed for 99.999999999 percent (11 nines) annual durability per object. You can even decide to take a snapshot of the EBS volumes. Such a snapshot then gets saved in Amazon S3, thus providing you the durability of Amazon S3. For more information on EBS durability, see the Durability and Availability section. EFS is designed for high durability and high availability, with data stored in multiple Availability Zones within an AWS Region.
Amazon S3
Amazon EFS
Static data or web content
If your data doesn’t change that often, Amazon S3 might represent a more cost-effective and scalable solution for storing this fixed information. Also, web content served out of Amazon EBS requires a web server running on Amazon EC2; in contrast, you can deliver web content directly out of Amazon S3 or from multiple EC2 instances using Amazon EFS.
Amazon S3
Amazon EFS
Relational database storage
In most cases, relational databases require storage that persists beyond the lifetime of a single EC2 instance, making EBS volumes the natural choice.
Amazon EC2 Amazon EBS
Shared storage
Instance store volumes are dedicated to a single EC2 instance and can’t be shared with other systems or users. If you need storage that can be detached from one instance and attached to a different instance, or if you need the ability to share data easily, Amazon EFS, Amazon S3, or Amazon EBS are better choices.
Amazon EFS Amazon S3 Amazon EBS
Snapshots
If you need the convenience, long-term durability, availability, and the ability to share point-in-time disk snapshots, EBS volumes are a better choice.
Amazon EBS