AWS Ports to Know

AWS and all computer systems divide networking traffic by IP address and subsequent ports. Ports are designed to subdivide network traffic to a specific protocol, application or process being used. It is helpful to know the most common ports used in modern information systems and below are the ones you should know for AWS certification.

ProtocolPort
FTP21
SSH22
SFTP22
HTTP80
HTTPS443
PostgreSQL5432
MySQL3306
Oracle1521
MSSQL1433
MariaDB3306
Aurora PostgreSQL5432
Aurora MySQL3306

AWS ElastiCache Security

AWS ElastiCache are in memory databases with very high performance and low latency. They designed to reduce the load on databases for high levels of reads. They allow your application to be stateless by placing the placing the current state of the data into ElastiCache. AWS takes care of OS maintenance, optimization, setup, configuration, monitoring, recovery and backup of the ElastiCache making it transparent to customer. Normally you have to perform a lot of code changes for existing application to use the ElastiCache option.

ElastiCache Security characteristics:

  1. For Redis IAM Authentication is support
  2. All other ElastiCache options require username and password
  3. IAM policies are only used for AWS API level security
  4. Redis AUTH
    • You can set password/token where creating a Redis cluster
    • Providing extra layer of security for you cache above you security group
    • Support SSL for network encryption.
  5. Memcached
    • Supports SASL based authentication

ElastiCache – Redis Use Case:

  • Establishing the leader in a game.
  • Each time a new score is added, it is ranked against all other scores (sorted) and presented in correct order.
  • This guarantees that the leader is always displayed at the top and in descending order.

AWS ElastiCache Build

AWS ElastiCache are in memory databases with very high performance and low latency.   They designed to reduce the load on databases for high levels of reads.  They allow your application to be stateless by placing the placing the current state of the data into ElastiCache. AWS takes care of OS maintenance, optimization, setup, configuration, monitoring, recovery and backup of the ElastiCache making it transparent to customer.   Normally you have to perform a lot of code changes for existing application to use the ElastiCache option.  Here we will build an ElastiCache service for use in your AWS environment.

1.  Logon to AWS as an IAM user at URL:  https://signin.aws.amazon.com/

2.  From the Home Console type elasticache in the search bar, select the star next to ElastiCache, and select ElastiCache

3.  Click the Get started button and select Redis OSS

4.  Next AWS will try to move you to the newer ElastiCache option of Valkey which will reduce cost with open source option.  Select create Valkey.

5.  Under Configuration select Valkey, Design your own cache, Easy create.

6.  Under Configuration select Demo and under cluster information enter a name for your cache.

7.  Under Connectivity select Create a new subnet group and name the group.

8.  Then click the Create button at the bottom of options.

 9.  This completes creating a ElastiCache in your AWS environment.

AWS ElastiCache Overview

AWS ElastiCache are in memory databases with very high performance and low latency. They designed to reduce the load on databases for high levels of reads. They allow your application to be stateless by placing the placing the current state of the data into ElastiCache. AWS takes care of OS maintenance, optimization, setup, configuration, monitoring, recovery and backup of the ElastiCache making it transparent to customer. Normally you have to perform a lot of code changes for existing application to use the ElastiCache option.

The architecture to use ElastiCache for RDS interaction:

  • Application query the ElastiCache
  • If ElastiCache has required data it returns to Application
  • If ElastiCache does not have required data it queries the RDS and returns it to Application (storing internally for next use).
  • This helps reduce the frequency of access to RDS proper
  • The application has to have a ElastiCache validation method to ensure data is most up to date.

The architecture to use ElastiCache for User Session Store:

  • User logon to application
  • Application writes user session data to ElastiCache
  • User hits a different application instance and their user session data is still valid.
  • Thus reducing the number of logins required by end user.

Compare Redis vs Memcached:

Redis:

  • Multi AZ with auto-failover
  • Provides read replicas to scale reads and give you high availability
  • Provides backup and restore
  • Support sets and sorted sets

Memcached:

  • Multi-node for partitioning of data providing sharding
  • Does not provide read replica
  • It is not persistent
  • provides backup and restore only with serverless version
  • provides multi-threaded architecture which increases performance.

AWS RDS Proxy

AWS Relational Database Service (RDS) Proxy are a way to access your RDS databases via a managed service rather than a direct connection to RDS.

This gives you the following benefits:

  • Allow application pooling and sharing of database connections.
  • Improves the database efficiency by reducing the burden of managing large number of open connections. Thus reducing the amount of CPU and RAM requirements.
  • RDS proxy is serverless
  • Autoscaling
  • provides high availability through multi-AZ configuration
  • Reduces the time of failover by up to 66%
  • RDS Proxy is supported by:
    • MySQL
    • PostgreSQL
    • MariaDB
    • MS SQL Server
    • Aurora
  • No code change is required on you applications.
  • It enforces the use of IAM authentication for database access
  • It requires the credentials to be stored in AWS Secrets Manager
  • RDS Proxy is not publicly accessible and only good within your VPC

AWS RDS Security

AWS Relational Database Service (RDS) normally contain very sensitive organizational data thus requiring the need for security.

AWS provides security of RDS data in the following ways:

  • At-rest encryption:
    • RDS databases and read replicas can be encrypted using AWS KMS, but must be defined at build time
    • The main (read/write) RDS database needs to be encrypted inorder for the read replicas to be encrypted.
    • To encrypt after RDS creation, you need to take RDS snapshot and restore to new encrypted RDS.
  • In-flight encryption:
    • TLS by default, using AWS TLS root certificates on the client side.
  • IAM Authentication:
    • Creation of IAM roles for access to RDS database instead of username and password.
  • Security Groups:
    • Controls the network access to your RDS or Aurora databases.
  • No SSH available except on Custom RDS builds.
  • Audit logs can be enabled and sending audit logs to CloudWatch for additional retention periods

AWS RDS Backups

AWS Relational Database Service (RDS) backups ensure that your data is recoverable and able to be replicated in a separate RDS datastore.

The characteristics of RDS Backups include:

  • Automatic Backups:
    • Daily full backup of the database (taken during the backup window)
    • Transaction logs are backed-up by RDS every 5 minutes
    • Ability to resore to any point in time (from oldest backup to 5 minutes ago)
    • 1 to 35 days of retention, set retention to 0 disables automatic backups.
  • Manual DB Snapshots
    • Manually triggered by the administer.
    • Retention of backup taken manually are as long as you want.
  • Reduce cost of stopped RDS backups by taking snapshot of RDS, deleting the RDS, and restoring the the snapshot to new RDS when it is needed again.

Aurora backups have slightly different characteristics:

  • Automatic backups
    • 1 to 35 days (cannot be disabled)
    • Point-in-time recovery at any point in backup timeframe.
  • Manual DB Snapshots
    • Manually triggered by the administer.
    • Retention of backup taken manually are as long as you want.

Restore RDS and Aurora options:

  • Restoring a RDS / Aurora backup or a snapshot creates a new database.
  • Restoring MySQL RDS database from S3
    • Create a backup of your on-premises database
    • Store it on Amazon S3 (object storage)
    • Restore the backup file onto a new RDS instance running MySQL
  • Restoring MySQL Aurora cluster from S3
    • Create a backup of your on-premises database using Percona XtraBackup
    • Store the backup file on Amazon S3
    • Restore the backup file onto a new Aurora cluster running MySQL

Aurora Database Cloning

  • Create a new Aurora DB Cluster from an existing one.
  • Faster than snapshot and restore
  • Uses copy-on-write protocal
    • initially, the new DB cluster uses the same data volume as the original DB cluser (fast and efficient – no copying is needed)
    • When updates are made to the new DB cluster data, then additional storage is allocated and data is copied to be separated.
  • Very fast and cost-effective
  • Useful to create test or development database from production database without impacting production database.

AWS Advance Aurora Topics

AWS Certificate topics cover a lot of advance topics on Aurora RDS. This article attempts to cover all questions which maybe asked about Aurora.

Aurora Replica Auto Scaling

  • Automatically increasing the number of read replica database based on increased CPU usage.
  • Reader endpoint automatically increased to accommodate new read replica databases.
  • Reader endpoint load balances over all read replica databases.

Aurora Custom Endpoints

  • You create some read replica database on larger EC2 instances for RDS.
  • Create Custom endpoint to allocate resources to larger EC2 instances for RDS.
  • Use case some process require more compute power from Read Replica IE Analytics.
  • You no longer use the read endpoint but setup different custom endpoints for different types of processing.

Aurora Serverless

  • Automated database instantiate and auto scaling based on usage
  • Good fro infrequent, intermittent or unpredictable workloads.
  • No capacity planning required.
  • Pay per second of use and can be more cost-effective.
  • Client goes through Proxy Fleet which determines the number of Aurora databases needed for the workload.

Global Aurora

  • Aurora Cross Region Read Replica
    • Useful for disaster recovery.
    • Simple to put in place.
  • Aurora Global Databases (recommended)
    • 1 Primary Region (read/write)
    • Up to 5 secondary (read-only) regions, replication lag is less than 1 second.
    • Up to 16 Read Replicas per secondary region
    • Helps for decreasing latency to clients.
    • Promoting another region (for disaster recovery) has an RTO of less than 1 minute.
    • Typical cross-region replication takes less than 1 second.

Aurora Machine Learning

  • Enables you to add ML-based predictions to your applications via SQL
  • Simple, optimized and secure integration between Aurora and AWS ML services
  • Supported services
    • Amazon SageMaker (use with any ML model)
    • Amazon Comprehend (for sentiment analysis)
  • You don’t have to have ML experience
  • Use Cases: fraud detection, ads targeting, sentiment analysis, product recommendations

Babelfish for Aurora PostgreSQL

  • Allows Aurora PostgreSQL to understand commands targeted for MS SQL Server (T-SQL)
  • Therefore Microsoft SQL Server based applications can work on Aurora PostgreSQL
  • Requires no to little code changes (using the same MS SQL Server client drivers)
  • Same applications can be used after a migration of your database (using AWS SCT and DMS)

AWS Aurora RDS Build

AWS Aurora RDS is the proprietary Amazon RDBMS system fully compatible with MySQL and PostgreSQL.  This document will demonstrate the build of Aurora RDS servers in the AWS environment.

1.   Logon to AWS as an IAM user at URL:  https://signin.aws.amazon.com/

2.   From the Home Console type RDS in the search bar, select the star next to RDS, and select RDS.   NOTE:  The name of the Console has changed over time, but the key wording is RDS.

3.   On the left hand menu bar select Databases.

4.   Currently we have no RDS databases created and thus none are listed.   Click Create database on the right hand side of the screen.

5.   Select standard creation and for this example we will create a Aurora (postgreSQL) database.

6.   Select the Engine Version you desire and Dev/Test

7.   Enter the DB identifier, master user name, Self Managed and password

8.   Enter Aurora Standard for Cluster storage.

 9.   Instance configuration select the standard configuration.

10.   Under VPC select the standard and note the VPC selected. As well as the DB subnet.  Select Yes for public accessible.

11.  Accept the rest of the defaults and select Create Database

12.  This completes build of Aurora RDS database service on AWS.

AWS RDS Custom for Oracle and SQL Server

AWS Relational Database Service (RDS) Custom gives you all the automation of RDS and access to the underlying database and OS.

RDS Custom you can perform the following tasks:

  • Configure underlying OS settings.
  • Install Patches.
  • Enable native features.
  • Access underlying EC2 Instance using SSH and SSM Session Manager.
  • Only available for Oracle and Microsoft SQL Server.

NOTE: While using RDS Custom, it is important De-active Automation Mode to prevent overriding of you customized changes.

RDS vs RDS Custom

  • RDS: manages entire database and OS by AWS.
  • RDS Custom: full admin access to the underlying OS and database.