Classic Solutions Architectures + Elastic Beanstalk Flashcards
What is a better option to using Elastic IPs in my EC2 instance infrastructure, if I don’t want interruptions to my website access?
ELB. Put the instances behind an ELB and use health checks.
Using Route 53 directly with your instances and elastic ips is a bad idea since you cant scale horizontally. If you remove an instance it will be in the TTL of the record and users wont be able to access it until the TTL is refreshed.
You can’t use a Route 53 Alias directly against the EC2 instances since aliases can only point to specific AWS resources, like ELBs.
With ELB you can scale horizontally without downtime since the elb wont redirect queries to the instances that are unhealthy.
And you can use an alias to give a dns name to the ELB.
Can I use an A record against an ELB?
No. ELBs IP address changes all the time. It could be a CNAME record but only if you dont use the apex of your domain.
Best option is an Alias pointing to the ELB resource.
How do you optimize your instance horizontal scaling in an ELB?
With an auto scaling group. ASG.
You set a min and a max, and when there is little demand, useless instances of your app will be deleted, saving you costs. And when you have more demand more instances will be created, meeting the demand.
How do you make your ELB application infrastructure highly available?
make your ELB multi az and spread your instancess across mulyiple target groups in different AZs.
How do you save money if you know you will have at least 6 instances running in your infrastructure?
With reserved instances. You commit to 1 or 3 years bu you save a lot of money.
If you have an ELB with auto scaling. How can you save money on instances for when you have high demand of horiontal scaling?
Use reserved instances for your base fleet, and use spot instances or spot fleet for when the demand increases.
What is a stateless app and a stateful app?
A stateless app doesn’t store user data. A stateful app does. Stateful apps use a database. Stateless apps don’t need one.
If you have a clothes shopping app behind an ELB, and users are losing their data for example a shopping cart. How do you avoid this?
An option is by enabling stickiness, which is an ELB feature.
Another option is using cookies. User stores the cart data with cookies in his browser. Cookies are limited to 4kb
A third option is using ElastiCache. User will have a server session, with a session id, and the cart data will be stored in elasticache. All instances in the ELB can retrieve the cart info from the same elasticache using the session id of the user.
How can you store user data long term for your web app?
With an RDS database.
How can you deal with increasing read demand on your RDS database?
One option is creating read replicas for dealing with the reads and alleviating load from the master db.
Another option is implementing an elasticache, and setting it up so it will keep the most requested data in its cache and respond to these requests instead of the RDS database, alleviating load from it.
What is a 3-tier architecture application?
An app architecture implementation consisting of a presentation tier (Client), Logic tier (Server), and data tier (Database).
if you want users to be able to store images in a website, for example wordpress, and this website is behind an ELB. What is the best option for storing the pictures?
EFS: Elastic file system is a share that can be accessed by all the instances of your ELB app at the sam time, since it’s an NFS.
EFS creates ENIs in all the AZs of your instances so it’s Multi AZ.
It’s shared storage so all instances in the ELB can read the images stored.
S3 is also a possibility. But EFS is lower latency from your EC2 instances. Depends on if its just storing stuff or that stuff needs to be accessed/read fast and frequently, in which case EFS is better for this case.
How can you instantiate your apps more quickly?
For EC2:
Prepare an AMI with everything you need for your app beforehand. This is called your “Golden AMI”.
Use the user data only for dynamic configurations on 1st launch.
Use Elastic Beanstalk, which is a mix of the previous 2.
For RDS:
Have a snapshot ready to restore from. The DB will have schemas and data ready for use.
For EBS Volumes:
Restore from Snapshot. Disk already formatted and with necessary data.
What is Elastic Beanstalk?
It’s a service that will automate the deployment and scaling of app infrastructures that use EC2, ELB, RDS, ElastiCache, ASG, etc.
The only responsibility for you when using beanstalk is to develop the app code.
With beanstalk, do you lose control of the components of the infrastructure?
No. You still have full control but the services come bundled with beanstalk.