EC2 Flashcards
What is user data?
User data is the data that is supplied by the user at time of instance launch in the form of a script
When is the user data executed?
By default, the user data scripts are run one time when you launch (creating an instance) the instance. To run the user data scripts every time you reboot or start the instance, add persist tag with the true value.
Scripts entered as user data are executed as the root user.
You can’t change the user data if the instance is running (even by using root user credentials), but you can view it.
Can user data be modified?
Yes, Open the Amazon EC2 console > Stop your instance > Choose Actions, choose Instance Settings, and then choose Edit User Data.
is there a limit for user data
16KB
Which user account is required for running the EC2 Instances?
Root User
What is the Security Groups?
Security Groups are fundamental to AWS Network Security. They control how the traffic is allowed in or out of the EC2 instances.
Security Groups only contain ALLOW rules.
What are EC2 Purchasing options?
- On-Demand: short workload, predictable pricing
Reserved: (Minimum 1 year) - Reserved Instance: Long workload
- Convertible Reserved Instances: Long Workloads with Flexible Instances
- Scheduled Reserved Instances: e.g. every Thursday between 3 and 6 pm
- Spot instances - Short workloads, cheap, and can lose instances (less reliable)
- Dedicated Host - Book the entire physical server
- Dedicated Instance - No other customer will share your hardware
- Capacity Reservation: Allows you to reserve capacity in a specific AZ for any duration
What are the features of EC2 on demand?
- Pay for what you use
- Linux or windows- billing per second after the first minute
- All of the operating systems- billing per hour
- Has the highest but no upfront payment
- No long-term commitment
- Recommended for short-term and uninterrupted workloads, where you can’t predict how the application will behave.
What are the features of EC2 reserved instances?
- Up to 72% discount compared to on demand
- Reservation. Is either one year or three years. Three-year reservation will provide more discount
- Recommended for steady-state usage applications example, database
- you can buy or sell the reserved instances in marketplace if you don’t need them anymore.
- Convertible Reserved Instance: can change the EC2 instance type, Instance family, os, scope and tendency
- Scheduled reserved instance (deprecated): launch within the time window you reserve, commitment for one year only from the stop
what are EC2 saving plans?
get a discount based on long-term usage. Commit to a certain type of usage - $10/hr for 1-3 years). Usage beyond EC2 saving plans is billed at the on-demand price.
You are logged to a specific instance family and AWS region (e.g., M5 in US-East-1). but you get the flexibility to increase instant size, OS, tenancy (host, dedicated, and default)
What is a convertible reserved instance?
Enables you to exchange one or more Convertible Reserved Instances for another Convertible Reserved Instance with a different configuration, including instance family, operating system, and tenancy.
There are no limits to how many times you perform an exchange, as long as the target Convertible Reserved Instance is of an equal or higher value than the Convertible Reserved Instances that you are exchanging. For more information, see Exchanging Convertible Reserved Instances.
What are EC2 spot instances?
- Amazon EC2 Spot Instances let you take advantage of unused EC2 capacity in the AWS cloud.
- Spot Instances are available at up to a 90% discount compared to On-Demand prices.
- You can use Spot Instances for various stateless, fault-tolerant, or flexible applications such as big data, containerized workloads, CI/CD, web servers, high-performance computing (HPC), and test & development workloads. Because Spot Instances are tightly integrated with AWS services such as Auto Scaling, EMR, ECS, CloudFormation, Data Pipeline, and AWS Batch, you can choose how to launch and maintain your applications running on Spot Instances.
- Moreover, you can easily combine Spot Instances with On-Demand, RIs, and Savings Plans Instances to optimize workload cost and performance. Due to the operating scale of AWS, Spot Instances can offer scale and cost savings to run hyper-scale workloads. You also have the option to hibernate, stop or terminate your Spot Instances when EC2 reclaims the capacity back with two minutes of notice.
How to request an EC2 spot instance?
- Define Maxi spot price and get the instance while the current spot price is less than Max. The early spot price varies based on offering capacity. If the current spot price exceeds your Max price, you may stop or terminate your instance with a 2-minute grace.
- Spot block: block spot instances during a specified time frame (1 - 6 hours) without interruptions. In rare situations, the instance may be reclaimed.
When to use spot instances?
- Batch jobs
- Data analysis
- Image processing
- Any distributed workload
- Workload with flexible start and end time
Not suitable for critical jobs and databases.
Spot instances are not interrupted because of higher competing bids
How to terminate spot instances?
You must cancel a spot request and then terminate the associated Spot instances. Canceling a spot request does not terminate instances. You only cancel spot instant requests that are open, active, or disabled.
What is EC2 dedicated host?
- An Amazon EC2 Dedicated Host is a physical server with EC2 instance capacity fully dedicated to your use. Dedicated Hosts can help you address compliance requirements and reduce costs by allowing you to use your existing server-bound software licenses.
- Allocated for your account for a 3-year period reservation
- More expensive
- Useful for software that has a complicated licensing model (BYOL – Bring Your Own License)
- Or for companies that have strong regulatory or compliance needs
What are EC2 dedicated instances?
Dedicated Instances are Amazon EC2 instances that run in a VPC on hardware dedicated to a single customer. Your Dedicated instances are physically isolated at the host hardware level from instances that belong to other AWS accounts. Dedicated instances may share hardware with other instances from the same AWS account that is not Dedicated instances. Pay for Dedicated Instances On-Demand, save up to 70% by purchasing Reserved Instances, or save up to 90% by purchasing Spot Instances.
It does not provide the additional visibility and controls of a dedicated host. Virtualize instances and hardware just for you.
Pay only for what you use with no long-term commitments. Dedicated Instance pricing has two components: (1) an hourly per instance usage fee and (2) a dedicated per region fee (note that you pay this once per hour regardless of how many Dedicated Instances you’re running).
Comparing Dedicated Hosts to Dedicated Instances?
An important difference between a Dedicated Host and a Dedicated instance is that a Dedicated Host gives you additional visibility and control over how instances are placed on a physical server, and you can consistently deploy your instances to the same physical server over time. As a result, Dedicated Hosts enable you to use your existing server-bound software licenses and address corporate compliance and regulatory requirements.
Which instance is right in which situation?
- On-demand: coming and staying in a resort whenever we like, we pay the full price
- Reserved: like planning ahead and if we plan to stay for a long time, we may get a good discount.
- Spot instances: the hotel allows people to bid for the empty rooms, and the highest bidder keeps the rooms. You can get kicked out at any time
- Dedicated Hosts: We book an entire building of the resort
What are the spot fleets?
A Spot Fleet is a collection, or fleet, of Spot Instances and optionally On-Demand Instances.
The Spot Fleet attempts to launch the number of Spot Instances and On-Demand Instances to meet the target capacity that you specified in the Spot Fleet request. The request for Spot Instances is fulfilled if there is available capacity and the maximum price you specified in the request exceeds the current Spot price. The Spot Fleet also attempts to maintain its target capacity fleet if your Spot Instances are interrupted.
What is Amazon machine image in (AMI)?
An Amazon Machine Image (AMI) is a supported and maintained image provided by AWS that provides the information required to launch an instance. You must specify an AMI when you launch an instance. You can launch multiple instances from a single AMI when you require multiple instances with the same configuration. You can use different AMIs to launch instances when you require instances with different configurations.
You can launch an instance from an existing AMI, customize the instance (for example, install software on the instance), and then save this updated configuration as a custom AMI. Instances launched from this new custom AMI include the customizations that you made when you created the AMI.
What is elastic network adapter (ENA)?
It provides higher packet-per-second performance and consistently lower inter-instance latencies. AWS currently supports enhanced networking capabilities using SR-IOV. SR-IOV provides direct access to network adapters and provides high performance and low latency. It’s only available for certain instance types.
What is Elastic Fabric Adapter (EFA)?
Elastic Fabric Adapter (EFA) is a network interface for Amazon EC2 instances that enables customers to run applications requiring high levels of inter-node communications at scale on AWS. Its custom-built operating system (OS) bypass hardware interface enhances the performance of inter-instance communications, which is critical to scaling these applications.
How many elastic IP’s you can have in your account?
you can only have 5 elastic IP’s in your account. You can ask AWS to increase that.
What’s the use of using elastic IP address?
You can mask the failure of an instance or a software by rapidly remapping the address to another instance in your account.
How many IP addresses you get by default with an EC2 instance?
By default, you get a private IP address for the internal AWS network and a public IP address. When we are doing SSH into our EC2 machine, we can’t use the private IP because we are not in the same network. We can only use the public IP address.
The public IP address can change if the instance is stopped and then started.
What are placement groups?
Placement groups are a logical grouping of instances. In AWS we don’t control the hardware but we can let AWS know how we want are instances to be placed.
What is cluster placement?
Cluster instances into a low latency group in a same rack and in a same availability zone.
Pros: It can provide enhanced network speed of up to 10 gigabits per second gonna.
Cons: if rack fails, all instances fail at the same time
Use case:
- Big data job that needs to complete fast.
- Application that needs extremely low latency and high network throughput.
What is the spread placement?
Instances spread across underlying hardware across availability zones.
Pros: reduce risk in simultaneous failure. EC2 instances are on different physical hardware
Cons: limited to 7 instances per AZ per placement group
Use case: application that needs maximum high availability. Critical applications where each instance must be isolated from failure from each other.
What is partition placement groups?
Partition – spreads your instances across logical partitions such that groups of instances in one partition do not share the underlying hardware with groups of instances in different partitions. This strategy is typically used by large distributed and replicated workloads, such as Hadoop, Cassandra, and Kafka.