AWS Data Engineer Certification Guide
AWS Data Engineer Certification Guide
Course 1
So first things first, is the data engineering associate certificate the right
certificate for you? To answer this question, let's go over the certificate. In
terms of prerequisites, AWS recommends the equivalent of 2 to 3 years in
data engineering or data architecture, and a minimum of 1 to 2 years of
hands-on experience with AWServices. Having said that though, technically
speaking, there are no hard prerequisites. You can still study for and attempt
the certificate without having these many years of experience. In terms of
achievements, this certificate should equip you with the knowledge and skills
needed to build systems and pipelines that collect, manage, and transform
your data into beneficial information. Your role as a data engineer revolves
around pipelines, so you'll manage the flow of the data by ingesting and
integrating it from various sources, and then ultimately publishing it into
reports. And if you like to view things from a visionary slash big picture
perspective, the purpose of your role is to make data accessible for data
scientists, analysts, and business specialists so that you can supply them
with the high-quality data needed for decision making. Having the exam is
broken down into 4 main domains. The first domain is data ingestion and
transformation. This is where you'll test your ability on sourcing and
transforming data in ETL pipelines. Next domain is data store management,
which is all about knowing how to pick the correct storage platform for the
right job and knowing how to configure it in an optimal matter. Data
operations and support is all about automating data processing via
AWServices. Lastly, data security and governance, as the name conveys, is
all about securing your AWS services, so it focuses on topics such as
authentication, authorization, encryption, and masking.
[Autogenerated] Now, let's talk about scheduling and taking the exam. If you
choose to take the exam through a test center, you'll obviously need to go to
the test center. So be prepared for any hiccups on the road, and if possible,
aim to arrive 30 minutes or so before the exam. You'll need to take your ID.
This can be your driver's license, passport, or some sort of an official ID card.
Lastly, be mentally prepared to work in a new environment. You might face
issues with a slow computer or a noisy environment. Nothing too crazy, but
it's definitely not a controlled home environment. So if you get distracted
easily, consider getting earbuds or getting into the habit of blocking out
noise. If on the other hand, you prefer having a more controlled environment,
you can go with the online proctored option. The process will start with you
using your personal computer to do a system check before taking the exam.
Here you'll check that your webcam and microphone are working as needed.
Someone will be watching you throughout the exam, hence why you'll need
to have your mic and camera up and running. Afterwards, you'll need to
install the proctoring software, and this is how the exam is delivered. It works
on presenting the exam, as well as shutting down all the background
programs on your computer while the exam is running. Therefore, to ensure
that everything is up and running, log in early. You can actually launch the
online exam up to 30 minutes prior to your scheduled time. Another
important piece to be mindful of is the setup of your room. So during the
check-in process, you'll be asked to take pictures of the room, and the
proctor will also get you to pan your webcam around the room. Basically,
you'll need to show that you only have one monitor in the room. That your
workspace is free of clutter, especially on your desk, and that you're in a
room where the door closes, and if they spot something that they don't like,
they'll ask you to fix it. For example, one time I had a mirror upon the wall in
front of my desk, and the proctor asked me to take it down. Other things to
keep in mind is that you're not allowed to take breaks, including bathroom
breaks. You're also not allowed to stand up during the exam. Likewise,
external interruptions aren't allowed either. So if someone enters the room
during testing, it's an automatic fail. Therefore, if you have children or pets,
make sure to lock everyone out. And lastly, just like the in-person exam,
you'll need to have your ID ready. You'll be asked to take pictures of the front
and back of your ID. To present it to the proctor during the check-in process.
Now, to wrap up, let's go over some final exam steps. Ideally, try to schedule
the exam early. You can even schedule the exam when you start studying to
ensure that you'll be able to take it on your preferred date. If you're not
pressed with a deadline, obviously you can wait till after studying to book the
exam. Just keep in mind that you might not find a spot right away. I waited till
the last minute one time and ended up taking the exam on the same day as
my daughter's birthday. Everything ultimately worked out, but it would have
been less hectic had I booked the exam ahead of time. In addition to
studying, I highly, highly recommend taking practice tests as many times as
you can and just aim to score at least 80% a couple of times. I wouldn't be
exaggerating if I said that this is as important as studying, because you'll
need to train your brain on how certain topics are presented. Next step is to
get hands-on by following the demos and hands-on labs in our playground
environment. And lastly, to avoid getting overwhelmed, try to split your
certification goal into various mini goals. For instance, you can aim to
complete a certain number of modules or clips per week. And I would urge
you to try to get into the habit of celebrating each one of those goals.
Besides the fact that it's more rewarding for many people, this actually
motivates them to keep up the momentum. And that's about it for the exam.
Where to go from here? Well, AWS recommends heading to the AWS certified
Security Specialty certification to go to the next level as a data engineer. My
guess is this probably has to do with the fact that the data engineering
certificate doesn't focus on security topics, which is still a critical domain for
data engineers. I hope that this clip helped you figure out whether to take
this certificate or not, and if so, I'll see you inside the course.
Data Ingestion
[Autogenerated] Hello everybody and welcome back to this learning path for
the data engineering exam in AWS. In this clip, we're going to be talking
about another service that's pretty big on the exam, and that is Kinesis.
Kinesis is primarily a data streaming service. This service allows you to
stream data in near real time, allowing you to ship that data to a point that
you set within your environment. There are 4 main services under the Kinesis
umbrella, the first being a data stream, which is kind of the first step in the
data collection process. The data stream gathers data from a specified point
and sends its streaming. The next step is the fire hose, which helps you
move that data from the data stream to a collection point within your
environment. You also have under this symbella of video streams, which
allows you to gain that data from video streaming services. Things like
security cameras, or even things like doorbells. These streams allow you to
store and easily analyze this video information that's coming through in
basically real time. And finally, we have the managed Apache flink. Which,
while it doesn't have kinesis in its name, it does still settle under that same
umbrella. Flink is a way to analyze this data combined with Zeppelin
notebooks from Apache, meaning that you can use SQL to dig deeper into
the data that you streamed into it. It also helps to transform your data and
structure it into nice neat tables. With these services, you're able to collect,
deliver, and analyze any data that gets pushed into that stream. You're also
able to interact with AWS services in a lot of different third party services
with only a minimal amount of effort. Let's talk about some of the services
under that umbrella that we just brushed past a minute ago. The first of
those services that we're going to talk about is Kinesis Data streams. Data
streams are a serverless way to stream your data from your source to a
storage place. Allowing you to go from incoming data into a storage. These
streams are made up of a group of shards that hold the data records. A data
record contains a sequence number which acts like an identifier, a partition
key which allows you to group your data shards together. And then the data
blob, which is the actual data within the shards. Within these streams there
are really two sides. You have the data producers. And then you have the
data consumers. The data producers are things like applications, services,
incoming streams. Anything that allows your data to come into your stream.
The consumer is on the opposite side of the stream, allowing you to take that
information from those applications, services, or streams, and help process it
or store it. So, let's take a look at the data flow within that stream. Like we
talked about in the last slide, you have a data producer, which can be a lot of
different things, be it in Internet of Things device or servers or container, that
data is getting pushed into kinesis. It will hit that first data stream, flow down
the stream, and come into a fire hose. In that fire hose, we'll send it to a data
consumer. Which the most popular services are things like S3, Redshift, and
some third party software. Data fire hoses are a delivery stream, meaning
that you gain data from the data stream and deliver that stream somewhere
else. These streams allow you to take data that is streamed and send it to a
destination. This also allows for things like monitoring the flow of data that's
coming through the stream and the fire hose, and confirming that your data
has successfully gotten to its destination. Sending this data allows you to get
it cataloged or stored in AWS or third party services. You can also send it to
services that allow you to process and potentially transform that data, such
as A patchy fling. Apache flink really allows you to dig deep into your data.
Allowing you to process that data with programming languages, SQL
commands, or some other processes to allow you to transform your data or
just to get it settled. Flink allows you to create notebooks using Apache
Zeppelin and build out the notebook to run specific commands against your
data. It also allows you to monitor the changes within that processing period
as you're going through your notebook. So let's talk about some of the
common uses for kinesis as a whole. One of the first things that it's normally
used for is anomaly detection. Take for example, Internet of Things devices.
Internet of Things devices can be kind of finicky. You need to keep track of
any changes that happen within these devices or any security blips that
might pop up. It also really helps with log production and processing for
machine learning applications. As these types of applications can change
insanely quickly, being able to monitor these logs in real time can be
incredibly helpful to help with course correction when your machine learning
has a tendency to go different directions than you expected. Kinesis also
helps with pattern detection within your data. Meaning you can actually find
changes incredibly quickly and are able to shift priority in your data captures.
And finally, of course, we also have click stream analysis, meaning you're
really able to keep track of where and what your people are clicking on on
sites to help curate your site for your users. Now, let's talk about benefits.
Kinesis has 4 main benefits that you need to keep in mind for this exam. The
first being that it's managed by AWS, meaning AWS once again handles the
underlying hardware and you're just focused on the top levels of application
management and service management. It's also serverless, meaning that
you don't have to actively consider server restrictions when you're building
out your data streams. It also allows for basically real-time data streaming,
meaning you can easily keep track of your data and know the changes that
are happening within your streams. Finally, you have actually built in auto
scaling, meaning that as your processes grow and shrink, they will
automatically build out quickly and efficiently. So one of the other things that
you need to be aware of for this exam. Is the difference between the four
main kinesis family services and SUS or simple Queervices. These two
services have their benefits, the first thing being the data retention period.
For kinesis, data is stored for 24 hours by default, but can be stored up to 7
days, while SQS has a default period of 1 minute, but it can be adjusted and
information can be stored up to 14 days. For Kinesis, you can have multiple
consumers for the same data record. While SQS you only have a singular
consumer per message, as once it is read, it gets removed from the queue.
Kinesis's workflow process is that it processes the shards that come into its
streams in the order of the shards, not necessarily the order of the shards
themselves. To alliterate on that a little bit more, what I mean is that your
shards can come in in a couple of different functions and formats. And
although we have things like the identifier and the partition key to try and
keep everything grouped together as much as possible, that doesn't
necessarily mean that things won't come a little bit out of order if data cops
up more quickly in one area than the other. A normal SQSQ also doesn't
guarantee the processing messages in order unless you build it out
specifically as a first in, first out style of queue. And finally, you have the
processing of the shards, you can have related records within those shards
sent to the same processor. Well, SQS doesn't really support that. If you have
all of these data records that have data blobs that are on the same topic,
these shards can usually be sent to the same processor to allow for quicker
and faster uploads. SQS doesn't really support that as an option. One of the
other comparable services that you need to take into account for the
differences in general are the differences between Kinesis and Apache Kafka.
We'll go into a little bit more detail and what Apache Kafka is in a later video.
Just be aware that these are some of the main differences between these two
services at this time. One of the things that you need to really consider is
that the configuration process between these two services is different.
Configurability within kinesis is limited. The most configuration you can
realistically do is where to write the data at the end of the resources. where
with CAFTA, you get a lot more wriggle room on the configuration of how the
data gets written. Things like what type of file type it gets saved in, where it
gets saved, how it gets saved, all of that good stuff. That's a little bit more
configurable than you would get with Kinesis. However, when we're talking
about the overarching cost of either of these services, you need to
remember that Kinesis is an AWS service, meaning that it is cloud native.
Meaning that like most cloud services, it is a pay as you go model and has a
more compartmentalized pay structure. While Kafka is a free to use software,
you do usually have a higher overarching cost, as it requires more active
engineering hours to manage it correctly. Though once you get it managed
and correctly set up, it's usually good to just sit and run. And finally, there's
the fact that once again Kinesis is a cloud software. So that means that it
was designed for quick and easy implementation and management. Well,
Kafka places you and your engineers to do all of the heavy lifting when it
comes to implementation, maintenances and overarching management in
general. With that, we've completed this clip. I hope you were able to learn
something, and I look forward to seeing you in the next one.
Hello, everybody and welcome back to the prep course for the AWS
engineering exam. In this clip, we're going to be talking about the AWS
service Redshift. So, what exactly is Redshift? Redshift is a fully-managed
data warehousing solution based on PostgreSQL. It has a lot of unique and
powerful features, making it a great solution for OLAP workloads. It supports
distributed workloads, as it's capable of processing data across multiple
nodes, and we'll see exactly how that works shortly. It also distributes these
workloads by storing data in columns instead of in rows. In terms of querying
capabilities, it offers the Redshift Query Editor, which is a web-based SQL
tool, allowing you to write and execute SQL queries, either directly in the
console or through the API. It also allows you to query petabytes of data. This
includes both structured data and semi-structured data. It can be deployed in
specific VPCs that have specific security and networking options to make
sure that it is completely isolated within that network. And, just like RDS,
Aurora, and DynamoDB, Redshift, too, also supports multi-availability zone
deployments. It's also offering a severless option, meaning that you can do a
lot more with it without having to be as quite as fiddly as some of the other
options. All right, now let's talk about some of the ways that you utilize
Redshift in the context of this exam. Redshift is a way for you to collect data
in a traditional data warehouse. This type of storage is like having a central
repository for your information. Data flows into the warehouse from a
transactional system, relevant databases, as well as other data sources. Data
warehousing also allows you to put together multiple data sources, so that
way you can run queries against all of your data, not just small groupings of
them, allowing you to save a lot of time and resources to not run repetitive
commands over and over and over again. Redshift also allows you to utilize
Log Analysis, meaning you can gain more information and data from your
logs. It also allows you to see more in-depth things like click-stream analytics
and hardware associations with these reports. In terms of architecture,
Redshift uses a cluster architecture, whereby each cluster is composed of
computing resources called nodes. They look kind of like this. You can have
up to 128 nodes per cluster. There are realistically two types of nodes within
these clusters, you have the leader node and a compute node. If you're
working in a singular-node cluster, you will have a singular compute node
and a singular leader node, and this is typically suited for small datasets or if
you're only deploying the cluster for testing purposes. Now, on the other
hand, if you're deploying a multi-node cluster, your cluster will consist of at
least two compute nodes, which is more suited for larger datasets or
production workloads. Okay, so now let's unpack the nodes a little bit more.
Let's look at the leader node first to take a look at what its responsibilities
really are. Okay, so these nodes are in charge of receiving queries from client
applications and parsing these queries and developing execution plans,
including execution plans that execute queries in parallel. Lastly, they
aggregate the results of these queries and return the results back to the
client. On the other hand, we have compute notes, and they have obviously
different responsibilities. They're in charge of partitioning the data into
smaller portions called slices, whereby each slice gets assigned a compute
node to achieve parallel processing. This processing is also known as slice
management. Compute nodes run the execution plans that the leader nodes
create and work on sending the intermediate data results back to the leader
node once they have gathered their data. And if we zoom out a bit, we can
see that the leader node is used to communicate with a client. And you can
see two lines here because realistically you either have a JDBC connection if
you're connecting using a Java-based application or an ODBC connection if
you're working with another API source. From here, the leader node
automatically distributes that data and query load across all the compute
nodes. And like we said, those compute nodes partition jobs into slices and
execute the plan. Once they're done, they send it back to the leader. The
leader then aggregates that results and sends it back to the client. This
process where work is distributed and data is separated into parallels across
multiple compute resources takes place under the umbrella of
massively-parallel processing, or MPP. So let's discuss some of the other
different types of nodes. Some of the more common node types include the
Dense Compute, or DC node, which is designed for demanding workloads
that need high-compute capacity, hence the name. And these are great for
workloads that are heavy on complex analytics and demand real-time
responses. The second type is a Dense Storage, or DS node, which are
designed to serve as large data warehouses. They are optimized for storage
intensive workloads, however, they typically offer slower performance, which
is why AWS recommends using RA3 nodes instead0. RA3 is distinguished by
its ability to scale, compute, and storage independently. It can automatically
offload data into S3 if a node grows beyond its capacity of a local SSD. And,
generally speaking, AWS recommends using this one over the Dense Storage
node models, as it is it a little bit more flexible with cloud in general. Okay,
so let's talk about the structure and preparation of a staging table. As you
can see, this is, well, a rather large block of code, so let's break this down
into chunks. To start off, we have the insert command, pushing data, in this
case, to the orders_summary table. These next few lines are information
about that data, customer key, order status, price, and so on. We then get
into the sorting section of this code, where we essentially rank the total price
interaction with a threshold. After that, it is splitting the table per order of
priority. If you have more important orders or what have you, it would split it
depending on what you need for it. And then, after that, we see the order is
being taken from the orders_staging table. So, let's talk about some scaling
options when it comes to Redshift. What happens when you need more
information, or if you find that your data warehousing options aren't nearly
as robust as you want them to be? You have a couple of options when it
comes to scaling outward. The first thing is you can add more Redshift
clusters, also referred to as concurrency scaling, because it allows you to
serve sudden spikes in concurrent read requests, thanks to Redshift's ability
to run queries in parallel. If you enable this feature, Redshift will
automatically add more compute power temporarily to meet the demand of
your high concurrency. Another scaling option is to query data via S3 using
the Redshift Spectrum functions, which enables you to query large volumes
of data in S3 without having to load the data into Redshift. In other words, it
allows you to jump to querying data without having to wait for the extract
transformation, load jobs, or ETL jobs to maintain access to that data. And
lastly, you can play with your clusters by scaling them either horizontally or
vertically. For instance, if you were horizontally scaling, you would scale in
and out by adding and removing nodes from the cluster. And for vertical
scaling, you can scale up or down by changing your node types. Realistically,
there are two ways to resize your clusters, the first is via what is known as
Elastic Resize. The second is referred to as Classic Resize. With a Classic
Resize, the operation copies tables and metadata from a source cluster to a
newly created table cluster. Now, what's the purpose of doing this? Well, one,
it allows you to increase and decrease the size of the cluster by adding or
removing nodes to the target cluster. But, keep in mind that the source
cluster goes into read-only mode during these resize operations. If this is
your source cluster, and this is your newly resized target cluster, the source
cluster will go into read only as soon as you start the resize operations. And
the next thing that you can achieve with a Classic Resize is changing the
node types of the cluster. And because this process copies all the data to the
new cluster, it ends up taking a decent more time to do this process. Lastly,
it's worth noting that this process doesn't retain the system log table of the
original cluster. However, things like user schemas, user data, user tables, all
of that gets copied from the source cluster to the target cluster. Now, let's
talk about Elastic Resize, and the main differences between the Elastic
Resize and Classic Resize. Well, let's first take a look at what happens when
you're resizing an existing cluster. It follows a similar approach in the sense
that you can add or remove nodes, but it does so via an in-place resizing
process, whereby nodes are added or removed in place of the existing
cluster. Therefore, the cluster becomes unavailable when you are adding or
removing the nodes during an Elastic Resize. On the other hand, if you
attempt to resize by upgrading the node type, a new cluster will be created.
So, let's say you have a source cluster and you initiate an Elastic Resize,
whereby you're upgrading the node types. Redshift will create a cluster
snapshot and use it to restore it to a new resize cluster. Similar to the Classic
Resize, the source cluster will be in read-only during this operation. And keep
in mind, you can only do this by upgrading the node types within the same
cluster type. Also, Elastic Resizing doesn't support downgrading node types.
But, in exchange to these limitations, it is much faster than Classic Resizing,
typically completing within minutes, all while retaining your system logs,
therefore, it's usually recommended as the first option unless you're thinking
that you might have to change the cluster type or downgrade your node
types. And with that, we have completed this clip. I hope you were able to
learn something from this, and I look forward to seeing you in the next one.
Hello, everybody, and welcome back to this learning path for this AWS exam
on data engineering. In this particular clip, we're going to be talking about
how to load data into Redshift. And in order to talk about that, we really need
to know where that data can come from. In terms of loading data, Redshift
can load data from a variety of AWS services, including, but not limited to,
S3. AWS Kinesis, EMR, DynamoDB, DMS, and RDS. So realistically, you can
load data into Redshift using what's known as COPY command and these
COPY commands can really be utilized in one of two different ways. Option
one is to load data from S3 into Redshift, and how that essentially works is
you have a data source, you load that data from the data source into S3, and
you follow a COPY command from S3 into your Redshift. And being from S3,
you're able to easily use said COPY commands to move that data into
Redshift. And then, of course, you have the second option, and option two is
to load directly from your source database into Redshift. So, for instance,
let's say you had a data source of DynamoDB, you could use a COPY
command to copy data from there directly into Redshift without hopping over
S3. That hop into S3 can be useful, as having a secondary set of data can be
helpful in things like disaster preparedness and making sure that you always
have a copy of it somewhere. Now, let's go over the steps needed for option
one. First, you need a Redshift cluster. After that, you need to split the files
that you wish to upload into multiple different files. This enables the COPY
command to leverage that MPP architecture that we learned about in the
previous lesson and load data in parallels. Then, ultimately, upload the file
into S3. Once the file has been uploaded, you can then create an IAM role,
assign S3 read permissions to that role, and attach that role to the cluster.
And with the IAM role out of the way, you can finally use your copy command
to load data from S3. Now, let's look over what a direct COPY command
would look like. In reality, it would look something like this, and you need
these three blocks of information to really complete that command. But, let's
dig into what these three lines of text actually mean. In the first line of this
command, we're identifying the target table, that's going to be the
destination within Redshift that we're going to be copying the data to. And
then the second line here, which says from, is going to be where we identify
our source bucket, as well as where we're taking the data from in general.
And, of course, to perform any of these operations, we need to have the
necessary permissions to do so. So, this line here is providing an ARN for an
IAM role that is granting us the necessary permissions to read that file within
S3. And so that is the basics of what a COPY command would look like if
you're copying data into Redshift. But what if you wanted to achieve the
opposite? Let's say you need to export data to S, well, that's where the
UNLOAD command comes in, which looks something like this. In the first line,
we specify the query to retrieve the data from our Redshift table, which is
going to act like the source in this particular scenario. The second line here,
we specify our target destination to determine which S3 bucket to send the
results of that query to. And similar to the last command, we're provisioning
our IAM role to make sure that we have the necessary permissions to
complete this command. Now, you also get an extra line here that we didn't
have in the last one, which is this phrase here, which is FORMAT PARQUET,
which is specifying the target file format that we are saving into S3. So, one
of the other commands that we really need to be aware of in the case of this
exam is going to be the VACUUM command, which I know sounds a little silly,
but it does have a very useful process within the Redshift sphere. And
VACUUM does a lot of like what it says on the tin, it reclaims space within a
table that a command is looking at. In this first command here, we see a full
vacuum of the sales table. Now, this method can take a little bit longer than
some of the other options we will be looking into, and it requires more space,
as it locks the table down and makes a full copy of that table, and doesn't
really seal the old one until it's done. But this will end with a smaller
database file overall. You can also set the thresholds to how much of the file
is reclaimed or dealt with. So, in this particular case, as you see on the
screen, you see VACUUM FULL sales, sales being the identifying table that
we're going to vacuum within Redshift. So the next variant in the VACUUM
command that we're talking about is the sort function. The sort function
allows you to resort your rows within a database, assuming that a specified
amount is already been sorted. So, in the case of this example here, VACUUM
sort only, meaning we're not reclaiming space, we're just sorting out what
was already here, again, on the sales table to 74 percent. So, assuming that
your sales table hasn't been sorted yet or hasn't been sorted recently, you
can make sure that it will sort up to 75% of that table to make sure that all of
your data is smoothly inside of the database. Now, finally, you have
reindexing. Reindexing allows you to potentially gain more space and have
your queries be more effective because reindexing allows you to combine
with vacuuming to reclaim space and make your overarching Redshift cluster
more effective, in general. But reindexing also allows you to make sure that
nothing has fallen into places that it shouldn't within your database. Again,
just like the structure we had in some of the other commands, you have the
actual command that we're using, VACUUM in this case, the variable, which
is the command that we're going to be also using inside of vacuum, which is
reindex, and the table that we're using this particular command on, in this
particular case listing. With that, you have completed this clip. I hope you
have learned something, and I look forward to seeing you in the next one.
Hello, everybody, and welcome back to this jaunt for the learning path of the
exam prep for data engineering in AWS. In this clip, we're going to be going
over Lambda. The service is touched on in the exam, and there will be some
basics that you really need to get down in order to gain some of those
much-needed points, so let's start with the basics. Lambda is split into two
different parts and both those parts work well together. There is the Lambda
function, the function is the code and workflow that you can prep to
complete tasks when events happen that match the trigger that you set
within the function. And then you have the Lambda service, the service is
what allows you to handle those incoming calls and is the underlying process
of the functions that are happening. They also handle the routing of the
inputs and outputs from the functions themselves. So, let's talk about some
popular use cases when it comes to utilizing Lambda. One of the most
common is for IOT devices, or Internet of Things. You could easily keep track
of changes that are happening within your devices or within your
environments using Lambda in this particular way. The triggers can be
anything from changes within the data stream to new devices being added to
the stream, allowing you to gain and process logs quickly and effectively. You
can also have serverless websites, which can have triggers on things for like
click-stream analysis, changes in traffic, but you can also have more in-depth
information, how traffic flows on your site, or where exactly people are
looking. You also, of course, have event-driven architecture that is utilized
within Lambda itself. This event-driven architecture means that whenever a
trigger has happened within Lambda causing one of the functions to go off, it
will create an automatic response without having to deal with a person
having to go and interact with that event. And thankfully, because of the
multitude of triggers that Lambda supports, this event can be just about
anything. So, let's do the breakdown of some of the benefits of Lambda. One
of the first things that we need to consider is the fact that Lambda is an
AWS-managed service, meaning that you can really put your focus in on the
code, workflows, and triggers without having to worry about the nitty-gritty
undertones of how much processing power do we need in order to fire off this
function. Amazon handles that for you, you don't have to think about it. The
other thing to be aware of is that Amazon is in charge of things like your
security when it comes to your Lambda functions and the service as a whole,
meaning that you do have to play by Amazon the rules when it comes to
things like having a trigger react into a certain action within another service
in AWS. So, in order to delete this particular action, you need to make sure
that your ducks are in a row, make sure that your IAM role has access to
wherever you're sending your function or information to. This overall process
is designed to keep your environment safer, as well as keep Amazon's
infrastructure more secure. The last thing is, much like a lot of cloud
software's, this is a pay-as-you-go model since you aren't paying for things
like electricity or things like that, you're just paying for specific runs of the
code. The other thing to be aware of is you get the first million requests free
per month, even when you're out of your trial period, that is something to
consider, meaning that you can have a good balance of the number of
events that you can process while still fine tuning your architecture within
your environment and have it be essentially free. When we dig below the
surface, you do get a few more benefits, like the extremely easy way it is to
build that responsive environment to those triggers and events. You also
have six different languages supported in runtimes so that you were able to
build out your code, allowing you a lot of different customization options. You
also get to tweak your code within the browser itself, meaning you can run
your code, see it has a flaw, or isn't working quite the way you thought it
would, make a tweak, redeploy, and you'll have your new codebase. And let's
say you made a mistake with some of those tweaking and you want to roll it
back to a last generation, because of the fact that you have constant control
over what persistent changes happen within your code and what persistent
changes are deployed within your Lambda function, you can easily roll back
your function so that way you can have an earlier version of your code. High
level, this is what you're looking at when you're building out a workflow.
When you're in the AWS console, you can jump into the Lambda section of
that console and create a function. This process can be done by scratch by
selecting the individual pieces and parts, and then causing the CREATE
function from within the portal. You can upload a blueprint, which is your
code and configuration presets all bundled together, or you can use a
container image that can deploy your function from there. Now, if you're
building from scratch, you do need to set all of your variables, things like
name, runtime language, architecture, all of that good stuff. For all of these
options, you also need to have an executable role that has the permissions
to collect the information coming in and to send it to where it's going. After
you create a function, you can either manually write your code within the
console or you can upload your code in a bundle, be it a ZIP or DMG function,
either one of those will work. This is really the meat of what causes your
functions to run, it is the action that is taken once the trigger is hit. And
finally, you have to specify a triggering event. This can be anything that's
potentially happening in your environment, as there are a lot of different
services that work within Lambda to actually go with this workflow. So, now
that we've talked about the process of creating a function, which will give us
a unique ARN to process that information, let's talk about the actual
requirements needed to run a Lambda service. With Lambda, you have a few
requirements to actually run the service as a whole, the first and foremost
being that you need a Lambda function, or the backbone of the event
response. You also need an IAM role, or a Identity Access Management
Execution role, meaning that you have to have a role inside of AWS with the
correct permissions to run both your function and has access to the services
that you'll be utilizing. The next thing that you need to remember is that you
need to specify your memory size, meaning that when you build out your
function, you can dictate how much memory you're going to be utilizing.
Now, this is also an editable value under your configuration settings within
the console itself, and the settings are always flexible between 128 MB and
10,240 MB. The next thing that you need to be aware of and take into
consideration is execution timeouts. An execution timeout is specifically how
long your function will wait before it will give up on that programmed action.
The limit within AWS when it comes to Lambda is 15 minutes. The last limit
we really need to go over is event-source mapping, or triggering for your
function. This is how you invoke your Lambda function to respond to events
that are happening within a service or services that you have designated for
the function to watch. So, let's go to the whiteboard for this. This is the
basics of what your environment looks like, you have an S3 bucket, a
Lambda function, and a DynamoDB table, and they're all happily sitting in
within your environment, just relaxing and waiting for input. And then we
have Steve. Steve has some information that he needs to upload into S3, for
both collaboration on a project and to make sure the file is safe. Now, once
Steve has uploaded that file into S3, it will trigger a Lambda function. Now,
this isn't the only way to trigger our Lambda function, Betsy can also trigger
it by utilizing the ARN of that function, either trigger method works. And once
the trigger is fired off, the function itself will happen, which, in this case is
writing to a DynamoDB table, taking stock of that new file currently within
the S3 bucket. This is the basics of how a Lambda function happens and
really all you need to know when it comes to the exam. With that, we have
completed this clip. I hope that you've gained something from this lesson,
and I look forward to seeing you in the next one.
Hello, everybody, and welcome back to the test prep for the Data
Engineering Associates exam for AWS. In this clip, we're going to be talking
about triggers. So, the first major question you're probably going to ask what
is trigger and in what context? A trigger in the context of this exam is a way
to allow resources to access other AWS services when specific actions are
taken or other things happen. When an event happens within your
environment, you are able to cause actions to happen within other resources,
assuming you have your triggers and events set up correctly. In this clip,
we'll be looking at specifically S3 events, EventBridge, and Redshift Events.
All right, let's talk about S3 event triggers. These events are seen as rules
within S3, allowing for actions to happen when conditions are met. For
example, a triggering event could be a file has been removed from a folder
or a new folder has been created. You can use these events to trigger all
sorts of other actions within your environment. New files being uploaded into
S3 could kick off a Lambda function to process that new file and make sure
that it's saving space within your S3 bucket, or a file being removed could
set off an SNS Proxy to make sure that notifications are sent out that there
has been a change within your S3 environment. These rules can push events
to a lot of different services, both on AWS and through third parties. And now
we're going to touch on EventBridge triggers. So, for EventBridge triggers,
you can set a number of different options for what these triggers can be.
This, much like S3, can be done in either a rule that you have in place or an
event pattern that happens in your environment. If an event matches the
pattern definition, it will send that event to the target, which triggers an
action, usually, that is specified by the rules. If something happens within
your environment, say an EC2 alarm goes off within your environment, with
these triggers in place, it can send out another alert to an AWS service, say,
SES, to make sure an extra email gets sent out to the admin team to know
exactly what's going on within the environment. So, the last thing that we're
going to talk about is Redshift events. These events are a log of everything
that happens or even changes within the cluster, new data being uploaded,
changes to tables, or changes to the database as a whole. Whenever an
event happens within Redshift, you get notifications from the subscriptions
that you personally are subscribed to or have been set to depending on your
environment, and these logs can be held for weeks at a time. These events
can be incredibly detailed, including date, description, where the event is
coming from, and the source ID. All right, let's talk about the three main
components that come with creating an event-driven architecture. And these
three services that we're going to be looking at are Kinesis, EventBridge, and
the Lamba. For Kinesis, you're looking at Data Streams. These Data Streams
can be configured to act as a trigger, being able to push data from the
source to a singular place, which can trigger a number of different services,
even services like Lambda. But what you need to remember is that these are
mapped to usually a singular destination. You also have EventBridge, where
events can follow specific rules and patterns, and when they match those
patterns or rules, they can act as triggers for one or multiple destinations,
meaning that these events and triggers can cause multiple services to react
at once. And finally, we have Lambda, which is honestly the most flexible of
the three. You have the most options when it comes to trigger actions from a
number of different services and actions that will allow you to have a lot of
customizable options when it comes to all the events that happen and allow
to be mapped to a service. Each of these particular services is useful in their
own way and can be very handy in building out your event-driven
architecture. There isn't necessarily to say one of these services is better
than the other, it's mostly that they're utilized for different specific things
and can do things that the others can't. With that, we have completed this
clip. I hope you have been able to learn something, and I look forward to
seeing you in the next one.
Hello, everybody, and welcome back to your trip down the learning path for
the AWS Data Engineering Associates exam. In this clip, we're going to be
talking about consuming data via APIs. First and foremost, let's talk about
what an API is and what it stands for. API stands for application programming
interface, which is what allows a server and an application to talk to each
other, with loops that look something like this, sending a request to the
server and the opposite side sending a response back to your client. In this
case, the application is sending a request to the App Server for information,
and then sending a response back from the App Server to the application to
allow work to continue. So, now that we have an idea of how the call and
response for API works, let's look at the four main APIs that we'll be
examining in this particular clip. The first we're going to be talking about is
SOAP APIs, then RPC APIs, a WebSocket API, and finally, the REST API. So,
let's go a little bit deeper in what each of these API types means. First, we're
going to consider the SOAP API, which SOAP stands for Simple Object Access
Protocol, which realistically is the standard messaging protocol that utilizes
HTML and XML messages, allowing easier communications between the
client and server. Then we have the RPC API, which stands for Remote
Procedure Calls. This is a protocol that also provides communication systems.
However, it's going to be utilizing an operating system rather than
router-specific messaging protocols. In other words, let's say you have an
application client and that client requests in action to happen within a server,
and that server sends that output from the action back to the client. This is
an example of what an RPC API call looks like. And now, we've got the
WebSocket API, which is a way to send communications between a web
browser to a server. This API allows the messages to be sent to a server and
receive event-driven responses without having to pull the server for multiple
replies. And then we have the REST API, which actually does stand for
Representational State Transfer. This type of API is a flexible and lightweight
way of bringing together applications and connecting them to components to
other services within your architecture. So, let's talk about the Data
Exchange really quick, as that's one of AWS's main API tools and something
that might pop up on the exam. As the name suggests, the Data Exchange
API is a way for you to move data between services, allowing you to set up
subscriptions that access that data and information. You also use the API
options to export or copy that dataset to S3, and then you can use that data
with a variety of different analytic tools. The Data Exchange API really has
two different functions. When you are the controller or provider for this
information or data, you're allowed to curate what data gets pushed out to
the subscribers of this particular dataset. So, let's break down the Data
Exchange API into parts. There are two main parts of the API setup. You start
with your dataset, which is a collection of data that changes over time, be it
through updates, growth, or changes, or maybe just revisions, be it with a
new version or just incremental changes within that dataset, all of it counts.
You then have the asset, which boils down to a piece of data, which can be a
number of different things, be it a AWS Data Lake formation, structured data,
or image file that would be short on S3. It could also be a Redshift data
share, any of these are an option of what an asset would look like within the
Data Exchange API. But speaking of Redshift in Data Exchange API, which is a
way to access your Redshift database, you are able to access this data from
using a web-based service application, services like Lambda, SageMaker,
Notebooks, Cloud9. Thankfully, you don't need to have a persistent
connection to your database to have the data flow, instead you get a secure
HTTP endpoint to work with your SDK, or Software Development Kit, with
these endpoints. You can run SQL commands without having to manage the
connections. Another note that isn't really mentioned in the exam, but might
be useful in your real-world experience, these data APIs have to use
credentials. These credentials can either be stored in Secret Manager or by
temporary credentials. However, they are not enterable passwords you need
to remember that in case you are ever flowing through this process. So, let's
talk about the troubleshooting thought process when it comes to the Redshift
data API. The first thing you need to make sure is that the caller, or
requester, is able to actually make a call to that dataset, both by ability and
authorization. The next thing to consider is that you need to determine if you
have credentials to get into that dataset. That database's credentials could
be, again, stored through temporary measures or with Secrets Manager.
Generally speaking, it is always good to try and complete best practices
when it comes to security and keeping your data together. In this case, it's
considered a best practice to have your Secrets Manager set up to hold your
credentials, the encryption, generally speaking, is better on these particular
cases. And if you're having problems connecting to your database using the
API, your best bet is to start from the bottom of the stack, things like check
your IAM permissions, your HTTP and your SDK endpoints are pointed in the
correct places in order for you to correctly connect to them. Starting out with
these types of troubleshooting ideas in mind is always useful. Remember,
start at the bottom and work your way back up. And finally, the thing to
consider is when you're calling the API using the command-line interface or
AWS's CLI from code, or if you're using the Query Editor from Redshift within
the console. Both of these options are valid, they just have different
challenges depending on what you're looking at. Users with CLI access might
have a slightly easier time moving their data than if you're just doing it
through the console, though both of these options are valid. The last thing
that we're going to talk about in this particular clip is going to be the Lambda
API. Much like we saw in our previous clip on Lambda, the Lambda API is also
serverless, meaning low maintenance, high customization. In the Lamba API,
you are able to utilize API gateways and API different status types, which
support a lot of different functions, things like routing your data, serving
HTMI files, or even storing binary files. This also helps to control traffic and
flow through your APIs, allowing you to have more things like redirects. With
that, we have completed this clip. I hope that you were able to learn
something from this, and I look forward to seeing you in the next one.
Data Transformation
Optimizing Costs
Hello, everybody, and welcome back. In this particular clip, we're going to be
talking about cost optimization when it comes to data transformation. We're
going to be going over three specific subjects when it comes to that
particular cost optimization. We're going to be going over Glue Python shells,
PySparks, and Spark jobs. Let's get started. Before we jump into those three
main targets, we're going to need to talk about something that actually
drives those particular processes inside of AWS. We need to specifically talk
about data processing units, or DPUs. A DPU is a computer processor that is
tightly integrated with a general-purpose CPU with a network-interfacing
hardware. DPUs allow you to make your processing jobs easier by allowing
you to dictate more resources to spread your load across multiple units,
meaning you can work faster and more effective. You're also dealing with a
cost being measured by how many DPUs you are utilizing. So, let's get into
the meat of this clip. The first thing that we're going to cover today is going
to be Apache Spark. Spark is a way to bring your data together, allowing you
to run jobs inside of AWS Glue and process data in a large batches. These
batches can be run as ETL scripts using glueetl through the command line.
Spark is also a framework that is utilized inside AWS EMR, therefore forming
features to Spark being your batch and data streaming, SQL analytics, data
science at scale, as well as machine-learning applications. PySpark, as the
name implies, is a Python API for Apache Spark, allowing you to use real-time
data processing with the flexibility of Python. The combination of Python and
Spark allowing the ease of use and ability to learn with Python, meaning you
don't have to learn anything specifically more complicated than your normal
Python language, and the active power of Spark being able to create multiple
jobs and handle a lot of data processing. AWS Glue supports the extension
for PySpark, allowing you to build out your ETL jobs reasonably from the AWS
CLI using Python or Boot3. The Python shell option in Glue is potentially
cheaper than just running Glue on its own, but let's break that down a little
bit. The Python shell for Glue is within the Spark environment. These shell
jobs allow you to run Python scripts, and you can use the various versions
based on what version of Glue that you are using to manage all of your data,
allowing you to easily keep up to date with both Python and Glue. This shell
is created and modified again through the CLI using the Python shell
command. The other ways that this particular shell makes your jobs a little
bit cheaper is you only need to utilize one DPU to get these jobs to actually
start running. Let's compare the two main options when it comes to doing
these ETL jobs through the Python shell of port Glue or for Spark, specifically.
Well, the Python starts with one DPU by default, it specifically is designed to
run lighter and quicker jobs, while Spark gives you a 10 DPUs by default,
meaning you can potentially run things faster as you spread out your data
resources across multiple different places, and allowing you to have more
processing power to deal with more data to be allocated. The payment
structure for both of these options are very similar, but not exactly the same.
With the Python shell, you are billed per hour with at least one minute
minimum. Spark, you are also billed per hour, but your bill is also variant on
what version of Glue you're running and the version of Python that
corresponds with that version of Glue. For example, Glue version 2.0 or later
has a 1-minute increment for bill time, whereas using 0.9 or 1.0 versions of
Glue has a 10-minute minimum. Finally, we have the fact that the Python
shell is designed to run light ETL jobs quick-and-simple load that don't
require a lot of resources, while Spark is designed to handle some of the
more hefty jobs. Spark is also designed specifically for scaling in mind,
allowing you to move horizontally, vertically, or both when it comes to
actually dealing with your ETL job with how much data you have coming in.
With that, we have completed this clip. I hope you've learned something, and
I look forward to seeing you in the next one.
Hello everybody, and welcome back to your prep course for the Data
Engineering Exam for AWS. In this module, we'll be talking about applying
programmatic concepts, specifically things having to do with Infrastructure
as Code, as well as some SQL concepts that you'll really have to get a handle
on in order to make it through this exam. Let's get started. So, what is IaC, or
Infrastructure as Code? Before we had IaC, we, as engineers or developers,
would have to build out our resources one by one, which is a whole thing.
When building out your environment at first, it's fine, with not as complicated
resources or security settings allowing you to build out your environment
however it grows. But, as time progresses, things obviously become more
complex, which means you have a lot of different chances to mess up your
builds by accident. This is where we can use IaC. Using software's like
CloudFormation or some third-party software's allow you to really standardize
your deployments and build out your whole environment in one go, making
certain that you don't have to worry as much about human error.
Realistically, you should consider utilizing IaC, or Infrastructure as Code, if
you're facing some of these issues, the first being that you're mapping out
your environment. Building out a blueprint using CloudFormation or some of
the other IaC options, allows you to see the flow of information and the flow
of traffic inside of your environment, meaning you're able to get a clear
picture of your overall environment. Another reason to utilize IaC is if you're
specifically building out your environment to respond to growth and changes
within your traffic. IaC allows you to take advantage of scaling options,
making sure your environment can scale with the changes that occur from
inside and out. There's also the automation to consider, building out these
environments can be complicated, and one small miss can make it so the
information just doesn't flow, or a small tick on a security platform can make
it so users can't interact with your environment. Though it can be really great
to have your blueprints down so you can really cut down on human error as a
whole or just error in general. Having an extra pair of eyes on a set of
blueprints always makes things a little bit easier. So, let's go over the main
options in AWS when it comes for IaC. The first, and probably the most
popular option, is CloudFormation, but that doesn't mean that it is the only
option. Another option that we have is the Cloud Development Kit, or the
CDK. We also have some third-party options when it comes to building out an
IaC for our environments inside of AWS. CloudFormation, specifically, is
AWS's built-in option for building out your environment and optimizing it for
any size. The Cloud Development Kit is kind of like a layer on top of
CloudFormation, allowing you to build your resources and environments in
different kinds of languages so you don't have to just stick with the YAML and
JSON specifically to build out your environment. We also have third-party
softwares that can still utilize with AWS, like Terraform, allowing you to sync
your environments with your code, making sure that they always match and
drift is less occur. It also allows you more wiggle room when it comes to
building out languages when compared specifically with CloudFormation. But
let's look at CloudFormation and the CDK case specifically since, realistically,
those are the main two that are going to be focused on this exam. So let's go
over the main points that you really need to understand in order to go into
this exam when it comes to CloudFormation. The first thing to dig into is that
CloudFormation utilizes templates written in YAML or JSON. Every time your
resources get built out, CloudFormation creates what's called a stack. These
stacks make it so that you can connect and build out to your resources all at
once. One of the things that really helps you make sure that you don't have
any drift or human error when it comes to your build out and templates,
specifically in your environments, is that CloudFormation utilizes change
sets. When you launch a stack or a new blueprint of resources, a change set
identifies the changes within your template compared to your environment
to make sure that you are aware of the actual changes that are going to
occur when you deploy your new resources. So the other option that gets
talked about very briefly in the exam is going to be the AWS CDK, or Cloud
Development Kit. This kit is a way to build out your environment using
developmental languages instead of just YAML or JSON, think closer to
JavaScript, Python, or C+. CDK really allows you more wiggle room when it
comes to your development cycles, as these are usually done inside of an
IDE, allowing for multiple people to actually build out at once. Also the type
of code that you utilize inside of a CDK can be declarative or imperative
statements. Declarative statements, meaning that you are relying on
supplying the exact results to the development, whereas imperative
statements are more for well-defined instructions. CDK also provides you a
library with your constructs or resources, these acts like building blocks that
contain everything you need to build out your resources. So, digging into the
main differences between CDK and CloudFormation, what we really need to
take a look at and dig into is the differences between the code styles. With
CDK, we have realistically three different levels of how our code is built out.
The first level to consider is the CloudFormation constructs, meaning that
you are using the same syntax as a CloudFormation and offer no abstracts,
which looks like this. This matches what a lot you would see inside of a
CloudFormation stack. The next level is an abstract construct, also known as
a curated construct, which are developed by the C K team and are usually
widely-used construct types, meaning that you can add cloud resources, but
have particular aspects that are not steadfast and defined like in
CloudFormation, and it looks like this. Finally, we have layer three, which is
known as pattern constructs, which allows you the highest level of
abstraction, allowing you to have prebuilt or custom patterns that you can
have multiple resources from one or more services. All right, so let's talk
about how exactly these services stack up against each other. Keep in mind
that you need CloudFormation in order to run CDK in order to deploy
resources, but let's still compare some of the basics about them. The first
thing that we can compare is how we build our code. With CDK, we can use a
lot of different code types to build out our infrastructure, whereas
CloudFormation allows you to utilize only YAML or JSON within your template
files. Next, we have the fact that CDK is more geared towards developers.
You get to thankfully write less code and deploy more. With CloudFormation,
you're dealing with more template files, meaning you always get a consistent
build out, but it can take more development cycles to actually get that
template file where it needs to be. We also need to consider the rollback
options for both of these resources. CloudFormation gives us a more visual
drift detection and can automatically rollback your build, informing you that
something went wrong through some of your code block, whereas CDK, you
don't get as much visual representation. Normally, when you're running a
CDK function, you'll just see that the build out failed and that you'll have to
try again. With that, we finished this clip. I hope I have cleared some things
up, and I look forward to seeing you in the next one.
Intro to SQL
Hello, everybody, and welcome back to the AWS Data Engineering Associate
learning path. In this clip, we're going to be talking about SQL, which stands
for Structured Query Language. This language is a coding style that looks a
little bit something like this. And when you use this code inside of a SQL
processor, usually a database that runs things like MariaDB or MySQL, you
are presented with information or a table that looks like this. As you can see,
this is a table with student IDs, the student first and last name, and then the
actual full name of that student, all of this information is given back to you
because of the code that you put in originally. So, when it comes to SQL,
there are a few services that AWS utilizes in relation to relational databases,
the first being RDS, which stands for relational database, which has a lot of
options when it comes to building out your databases, including eight
different flavors of build options. You also have Redshift, which we talked
about in an earlier clip, and AWS Athena, which is a service that allows you to
filter your data and see your data from places like S3 or Glue. Athena also
lets you get a more in depth look of how things are going inside of your data,
making it easier to see patterns and changes within it. So, let's talk about
some of the common commands that you will see with SQL, the first being
the SELECT command, which is a way for us to pull data from tables within
the database, giving you a detailed report on your database. Next, you have
the WHERE clause, which allows you to filter your data records to only pull
what you need from your tables. Then, you have AND, which works with
other clauses, allowing you to chain conditions together to build out the
perfect command that you're looking for in your database. You also have OR,
which allows you to filter your results, but you can filter things by different
markers, giving you more options to have specific result patterns. The next
few options are more, think of aggregators, things that bring your data
together. First off, you have ORDER BY, which allows you to sort your results
by conditions from your table. And finally, you have a GROUP BY, which
allows you to pull all sorts of records and make your own aggregated results
with things like count to have the number of results happening within a table
or database. So, some other commands you should probably remember for
your career journey, but are not necessary for the exam overall, these are
some of the commands that allow you to move things and modify your
database as a whole. The first is INSERT, which means that you add your
data into a table with customized options to add things to multiple tables.
Next, we have the CREATE statement, which allows you to actually build your
environment of tables and databases. After that, we have UPDATE, which,
much like it says on the tin, allows you to change existing records within
different tables and databases. And finally, we have DELETE, which allows
you to remove records from your tables or databases or delete full on tables
from your databases. So let's go over some necessary reference points when
it comes to building out your commands. First and foremost, remember, your
commands, clauses, and the like, will always be written in capital letters,
which can list the differences between commands and the description words
for things like your table names, and like. The next thing to be aware of that
brackets are to add optional things for you to add within your command. This
can be either to change the command overall or to dial-in things within your
command to get exactly what you need. You also have curly brackets, which
help you build your commands as well, but it allows you to choose between
different arguments to get the right data you need. After that, we can
consider pipes, not those kind of pipes. There we go. Pipes allow you to
choose between different arguments to get the right data. They also allow
you potentially to chain your commands together. Italics in commands are
things that you need to change. So let's say that you have some example
code that is being used within your documentation, you would need to
change what is in those italics, things like table names, to make sure your
command is actually working. The three dots, or ellipses, are a way to tell
people examining your code to repeat whatever comes before it. Then,
finally, you have quotation marks, which are for putting around strings within
your commands. You can use single quotes for literal meanings, like what's in
the quote has a specific meaning within your command, and you have
double quotes for identifying things, like tables, columns, and row names. So
let's talk about some of the argument syntax when it comes to SQL. The first
syntax you need to be aware of is the dollar sign, which allows us to look for
letters within a string which is sorted by a position. Next, we have the caret,
which allows you to create commands that look for one or the other
conditional argument being true, but not both of them. Then we have the
percent symbol, which is used to look for things in your data like specific
numbers within your order tables, or like in the example on screen, where
you have %at%, which leads to a data response on your report back. Then
we have the ampersand, which allows you to combine your operations and
invoke bitwise on your commands. So, bitwise is a way for you to add binary
values to your results that you're pulling for your tables, translating your
characters and statements into binary. So, let's go over some of the ways to
optimize your queries. Whenever you're doing an SQL command, try and
avoid select *, as it will pull back everything inside of your table, which can
not only take a while to come back as an actual report, but you also have to
worry about the strain it puts on the database as a whole. Try and aggregate
your commands, meaning that you can really pull pieces of data with case
expression, which saves you engineering cycles so you don't have to keep
selecting the same tables with the same commands over and over again.
Next, try and restrict your data predicates, meaning that you can filter and
restrict your data that returns in queries, meaning you don't have to bring
back your whole table. Another thing to consider is try using joins when they
are more effective. Another thing to consider is try using INNER joins when
you have to join your tables together, as they're a little bit more effective
than some of the other join types. We have another video specifically talking
about joins a little bit later in the module. Avoid unions unless you absolutely
need to combine SELECT statement results. These commands can really
make your database chug, but these commands can be useful when
necessary. Try and be as specific as possible, meaning that you can get back
exactly what you need without having to filter your results, saving you a lot
of time and effort overall. And finally, the EXPLAIN command is your friend.
This command is very helpful when it comes to showing you how your
command is going to run, and what is the reference point for what that
command is looking at. With that, we have finished out this clip. I hope
you're able to learn something, and I look forward to seeing you in the next
one.
Let’s Talk about SQL Joins
Hello, everybody, and welcome back to the prep for the data engineering
associates exam for AWS. In this clip, we're going to be talking about the two
main ways that you're going to connect into the database. Realistically, you
just need to know the basics for this exam so that's all we're really going to
be diving into. The first way to connect is through JDBC, which stands for Java
Database Connectivity. So, let's talk about these connections. You first start
with your custom codebase that you've uploaded to the database. This can
be accomplished by using JDBC, which is broken down into two real parts, the
API and the driver. Both of these parts roll into a device that contains the
connections into the database. There are four main types of JDBC drivers, the
first is the JDBC-ODBC bridge that translates and converts the Java that's
coming from your code to an ODBC function. ODBC is another connection
method that we'll be talking about in just a minute. You also have native API
drivers that allow you to have the client-side libraries for your target
databases. Then, you have network protocol drivers, which uses software in
between to convert your JDBC into a traditional database call. These
softwares are normally called middleware and have a variety of different
methods. And finally, we have the database protocol drivers, also called thin
drivers, allowing your JDBC calls directly into vendor-specific database
protocols. Now, let's talk about the open-database connectivity, or ODBC.
This type of connection stems from an application sending information into a
driver that is usually localized on your device that your database is on, so
that driver sends that information to the data source and/or databases. And
here's kind of the main breakdown for the ODBC main components. The first
component is an application process that calls the ODBC functions and
submit SQL queries or commands into the database and requests. You also
have drivers that manage and load other drivers for every application that
sends a call to your database, with a centralized driver on an OS of the
device that your database is on. These drivers handle the calls and sends the
data back to its source, allowing them to see the information with the
database and call centers. The data source is just like it says on the tin,
where your data is stored and can be accessed by the drivers as a whole. So,
let's talk about the main differences in these two types of connections, JDBC
versus ODBC. One of the main things to be aware of is fairly straightforward
is JDBC is in the Java language only, while ODBC is much more open, allowing
you to program in just about any language. However, JDBC does allow itself
to be used on just about any platform. There's a lot of go between and
translator softwares allowing it to run off of most OSs, whereas ODBC mostly
is just a Windows option. When either of these drivers gets a call, they both
respond, but they do it in different ways. JDBC is object oriented, meaning
your data objects are seen as, well, objects and set bundles, while ODBC is
procedural, meaning it follows more of a set list inside of its calls, ticking off
boxes as it's going down the call itself. With that, we have completed this
clip. I hope you're able to gain something from this, and I look forward to
seeing you in the next one.
Hello, everybody, and welcome back into this journey to gain your data
engineering certification through AWS. In this clip, we'll be talking about how
the puzzle that is big data comes all together. Let's get started. So, let's
wade into the data ecosystem for a moment. The ecosystem in this example
is going to be a modern sales forecasting. So, what do you need to get
started in this environment? The first thing that you need to do is find a data
source to gain the insights on your sales and products. After you find the
data sources that you can get to, you need to be able to transform your
analytics from your data pools into a price leverage, meaning that you'll
have more of an idea of what people are looking to pay for your product or
service. And finally, you can leverage AI when it comes to getting more
information out of your data pools and analytics, allowing you to do things
like having more predictable outcomes and making sure that your inputs
actually follow a strategical pattern. So, let's build out a data lake. We can
start by taking in our data ingestion points. From there, you get options on
how to process your data, which you have the options to either process that
information by taking it down locally or by following blueprints within AWS to
deal with that information. You can also bounce between these two options
before moving on to the next step, which is cleaning your data. Cleaning
your data does things like getting rid of duplicate information, filling in any
gaps that are within your data, and making sure that your data is actually
relevant to what you're looking for. Now, once your information is all cleared
and analyzed, it's a good idea to set it through some security policies, be
that through compliance policies, encryptions, or some other options that are
available within AWS. After your security within the data lake is secured, we
can make our data more presentable for an analytic possibilities throughout
our environment. We can also make it generate reports for people who aren't
as data minded. So let's talk about the life cycle of the data lake as a whole.
Realistically, it starts with an ingestion and transfer, allowing you to gain new
information within the lake and transferring that to the processing options.
This moves into security and storage. The data moves into security, allowing
you to lock down your information to disable people from seeing what they
shouldn't. And once the security is set, you can set up storage for your data.
Being that you can set up places to contain your information, then you can
transform your data for various reports and business uses. And once that's
set up, you can get to analyzing and monitoring the data that's coming in
and flowing into your storage space. Once you get all of your transformation
and business uses set up, you realistically are going to monitor and analyze
the overall pipeline to make sure everything works the way that it should,
and fulfills your business needs. So, let's talk about the overall stages of
data. So, most data comes from a data source, be that a file type like S3 or a
data link. Now, when it comes to these data sources, they can offer two
different ways of processing. The first, being through real-time ingestion and
the second being through specifically data storage. Both of these options are
valid, it just depends from there which way you're processing. From here,
after the data source is ingested using services like Kinesis, or stored using
services like S3, it then promptly can move into the actual analytics stage,
which can be done via batch processing, machine learning, or using a stream
processing using things like Managed Apache Flick. And, you don't have to
necessarily go in this particular order when it comes to your processing, you
can go in just about any way you want to, your real-time ingestion or storage
spaces can really enter into any of these particular options without much
effort. Once they've been processed either by services like a Glue or Apache
Flink or even some of our machine-learning objects, we then go into the
analytic data store, meaning that you can do things like RDS or Redshift to
keep a track on what exactly is happening within your data stream, and
allows you to really dig in deep to what your data is actually saying. And
through this analytics, you can get things like reporting and dashboards.
Realistically, these things can go in a multiple of different directions. These
reports and analytics stores don't have to necessarily go in one direction, as
we see here. There are a lot of different options when it comes to building
out your stages with building out your data. It's very customizable, meaning
there's a lot of different ways to get to your end goal, which is your reports
and dashboards, making it presentable anyone within your business
operations to see what your data is saying. With that, we have completed
this clip. I hope you were able to gain something from this, and I look forward
to seeing you in the next one.
Conclusion
Summary
Hello, everybody, and welcome back to the last module of this leg of the
learning path for the AWS Engineering Associates exam prep. First of all,
congratulations, you've made it through the ingestion portion of this learning
path, but you are well on your way to being ready to ace this exam. Let's go
over some quick touch points from this leg so that way you can have a quick
refresh before you start on the next one. Here is a brief overview of the
topics we covered in the first module. Now, let's look at some of the main
touch points from all of these particular lessons. So a quick recap on AWS
Glue, Glue is an ingestion tool, it is a serverless solution for discovering,
prepping, and combining data, allowing you to pull data from different
sources to build catalogs for data operations. Glue has multiple capabilities,
allowing you to do quite a few different tasks within one service, allowing you
to do things like creating ETL jobs, gathering, storing, processing, and
cataloging data all in one service. It also allows for a lot of third-party
services that can interact within your Glue environment. The three main
types of triggers within Glue are event based or things that are happening
within your environment, time based, so that the way they happen on a
schedule, or on-demand based, which is you are personally in charge of
starting and stopping these particular events. Amazon Kinesis is primarily a
data-streaming service. The service allows you to stream data in near real
time, shipping that data to a point that you set within your environment, and
analyzing your data to gain more relevance from your data as a whole. There
are four main services under the Kinesis umbrella, the first being the Data
Stream, which is kind of the first step in your data-collection process,
gathering data from the specified point. The next step being Firehose, which
helps you move that data from the Data Stream to the collection point within
your environment. You also have under this umbrella Video Streams, allowing
you to store and easily analyze that video information that's coming through
from things like CCTV cameras or Internet-of-Things devices. And finally, you
have the Managed Apache Flink, which, while it doesn't have Kinesis in its
name, does still settle underneath this umbrella. Flink is a way for you to
analyze your data, combining it with Zeppelin notebooks, meaning that you
can use SQL to dig deeper in your data. You're able to transform your data
and structure your data in neat, easy-to-read tables. These services allow
you to collect and analyze your data with active streaming data. They also
allow you to interact with AWS services and multiple third-party services with
very minimal effort. Redshift is a way for you to collect data in a traditional
data warehouse. This type of storage is a central repository for your
information, data flowing into this warehouse from transactional systems,
relational databases, as well as a few other sources. Data warehousing also
allows you to put together multiple data sources so that way you can run
your queries against all of your data, not just small groupings of data,
allowing you to save time and resources, so you don't have to keep running
repetitive commands. Redshift also allows you to utilize Log Analytics,
meaning you can gain more information and data from your logs, seeing
more in depth on things like click-stream analysis and hardware associations
within your report. And finally, you have the business intelligence, which gets
you incredibly detailed and easy-to-read information on customizable
dashboards. These dashboards and reports make it so that anyone should be
able to understand the data that you're linking to them, so that way even the
most non-data savvy should still be able to gain information from your
resources. Now, let's talk about how we can load that data into Redshift. You
can load data into Redshift using what's known as COPY commands, and you
can do this through one of two ways, option one is to load data from S3. So,
with this option, you would need to load data into S3 first, then use your
COPY command to copy that data into Redshift. Your data source can be
things like RDS, a Kinesis Firehose, or any other type of data source. Then
you can load to S3, so, in other words, if your data is in S3, you can easily
use COPY commands to move that data into Redshift. Option two is that you
load your data in from a specified database, so you would move that data
specifically from your source database directly into Redshift. So, for this
example, let's say your data source is DynamoDB, you can use COPY
commands to copy the data directly to Redshift without hopping over S3. So
you also need to remember that there are three main trigger types when it
comes to data ingestion within your AWS environment, S3 event triggers,
EventBridge event triggers, and Redshift event triggers. Now, let's have a
quick rundown of how you can set up a Lambda environment. Remember this
is the example of your environment, it's currently waiting for input. Steve has
some information that he needs to load into S3 for both collaboration on his
project and to make sure that the file is safe. Now, once Steve has loaded
this file into S3, it will trigger a Lambda function. But that isn't the only way
to trigger that function, Betsy can also trigger that function utilizing an ARN
from the function. Either trigger method works, and once the trigger has
been fired, your function happens, which, in this case, allows you to write to
a DynamoDB table, allowing you to take stock of the new file that is currently
within the S3 bucket. This is the basics of how a Lambda function works. Now
let's talk about API, which stands for application programming interface,
which is really just the operation of allowing your server and your application
to talk to each other in a loop that looks something like this. Sending a
request, and then the opposite side sending a response. In this case, the
application sending a request of the App Server for information and then
sending a response back from the App Server to the application. When it
comes to your basic security architecture, I want you to remember that,
specifically, you are looking at a VPC that is built out like a shell with your
subnets inside of it, your security groups on top of that, and your NACL then
allowing access from the public back out. Things to also remember, that
security groups helped you filter who has access to your VPC, it is a stateful
control process, and allows you to add and block traffic, whereas NACLs, or
Network Access Control Lists, are stateless ways for people to access into
your VPC and subnets. NACLs are also a layer of security for your VPC and
acts as one of your first line of defenses in firewalls. In the next module, we
really focus on data transformation. Here are the clips that we covered in this
particular module, let's go over them in a little bit more detail. So, let's
review the blueprint of how the data processing works in steps. First, you
have data that gets pulled or extracted from various sources, it gets pushed
into a data lake where it is validated and transformed into readable data, and
then it is loaded into a target database. Once in that database, it can be
quickly published into reports for your business needs. These build options
happen very quickly and effectively, allowing for information to really flow
like a river through your environment, allowing you to quickly change tactics
if necessary. So the other thing to keep in mind when you're taking this exam
is that there are two main container types that work within the data
structure, the first being the ECS, which is your Amazon Elastic Container
Service, and then EKS, which is Elastic Kubernetes Services. Let's also do a
quick review of what EMR is. EMR is AWS's big-data solution for huge scale
data processing and interactive analytics, with some sprinkles of machine
learning no top of it. This big-data solution builds off of an open-source
framework, usually an Apache subset, think Hive, Spark, Presto, that kind of
stuff, and then runs on a variety of different services within AWS. EMR allows
you to run with a cluster, that cluster can be anything from EC2s, EKS
containers, or it could also be something like outpost or some other
completely serverless options. With these data processing options, you can
use a lot of AWS services to help you develop, run, visualize, and debug your
pipelines. It can also be used for data-science applications, SQL queries, and
machine-learning workloads. Now I can touch on the three cost-cutting
measures when it comes to ETL jobs. The first method, which is Apache
Spark, the PySpark, and the Python shell for Glue. That first method in
Apache Spark allows you to unify analytics and data. The next method is
PySpark, which is a Python SPI for Apache Spark. And finally, we have the
Python shell option within Glue, which is potentially cheaper than just Glue
on its own. The other way that this particular style makes jobs slightly
cheaper is that it defaults to one DPU to actually run Python shell jobs within
Glue. The third module we went over was applying programming concepts.
Here are the clips that we covered in this particular module, let's go over
them in a little bit more detail. So, as a reminder, there are three main IAC
options, which are CloudFormation, which is the first and probably the most
popular when it comes to AWS, we also have the Cloud Development Kit, or
the CDK, then we have third-party options like Terraform. CloudFormation is
AWS's built-in option for building environments, optimized for any size. The
Cloud Development Kit is a layer on top of CloudFormation, allowing you to
build out your resources and environments in different languages. And then,
of course, you have third-party software's like Terraform, allowing you to sync
your current environment with your Terraform files, making sure that your
environment always matches your code, and allowing you to build your
resources with buildings happening in different languages. So, next, let's talk
about SQL, or the structured query language. This language is a coding style
that looks something like this. Now, when you use that code, you are
presented with information or a table that looks something like this. As you
can see, on this table, you have four different columns of information, the
studentID, the first name of the student, the last name of the student, and
then the full name of the student. Now let's talk about the various types of
joins you have when you're talking about SQL. There are four different types,
the one on the far left, which is your Inner Join, which allows you to only take
back things that match from both databases; Left Joins, which takes
everything from a primary database and the matching from the secondary
database; Right Joins, which, much like Left Joins, take everything from a
secondary database and the matching primary database; and then, finally,
you have Full Joins, which pulls everything from both databases, including
what's matching between them. Now, we're going to touch on pivoting,
which is the ability to combine data from tables. In this example, we have
this particular chart, which has three main columns, being the Sales Person,
the Product, as well as the items being sold. As you can see, Jane and John
both have two entries, one for Apples and one for Oranges. With this
particular query, however, we would be able to have the Salesperson and the
Products from the Sales data table, and we are using this as a source table
for our pivot. Within the pivot, we're using the argument of COUNT in Sales
for both apples and oranges, and creating a new table, which looks like this,
where we have the Sales Persons have individual rows, but the Apples and
Oranges are two individual columns. This allows you to combine some of that
information and makes it a little more easy to read in general. Next, as a
reminder about Tumbling Windows, you have a couple of main metrics,
specifically the stream of incoming data over a specified period of time.
Within these specified periods of time, you have these individual windows
where data is flowing through the windows in various shapes and formats.
But these windows never specifically overlap, allowing you to make sure that
your data comes in and is processed in the fashion that it is entered from the
window. Next, we're going to have a quick comparison of the two different
types of connections. JDBC is in Java-only language, whereas ODBC allows for
multiple language in programming, usually specializing in C and C++. JDBC
can be used on just about any platform, as there are a lot of go-betweens
and translator softwares, allowing you to run off of most OSs, whereas ODBC
is mostly a Windows-only device. When either of these drivers gets a call,
they both respond, but they do so in different ways. JDBC is more
object-oriented, meaning that your data objects are seen as just that,
objects, and have set bundles within their packets, whereas ODBC is more
procedural, meaning that it's looking more for the context within the lists
inside of your calls. The other thing that you need to remember as a touch
point for your exam is the lifecycle of your data lakes. Remember, you are
ingesting and transferring data from wherever your sources may be to gain
that new information to the lake. You are then securing and storing that data
to be able to be processed. We can then transform and use that data for our
analytical purposes, such as dashboards, notebooks, and builds. And once all
of that is set up, we can monitor and analyze our information flowing into our
data lake to make sure that we actually have a stable environment for our
business needs. And with the highlight reel complete, you are one step closer
to being ready for your exam. I hope this refresher helped you out, and I look
forward to seeing you in the next leg of this adventure.
Data Ingestion and Transformation: Exam Tips
Welcome back, everybody. Let's go over some prep questions for your exam
from within the data-ingestion space. One of the things that I want you to
remember when you're taking this exam is to keep things as simple as
possible, and that includes when you're indicating costs. When you're doing
the calculations for costs of resources, as well as through implementation,
just be aware that the cost of code and resources are not going to be the
only part of your calculation, engineering cycles, and the cost of those
cycles, as well as how things are implemented and maintained are also going
to have to factor into your calculations. But let's jump into some of these
questions. So, here's an example question that we can take away from the
blueprint. What AWS service do you utilize for basically real-time batch
analyzation? While there are many services when it comes to data
processing and analytics, the words you need to focus on in this particular
case are near real time and batching. When you see real time or near real
time, remember the Kinesis family of services. And when you see the word
batch is also mentioned within this context, it usually is always referring to
Apache Flink. All right, the next question is, what is the name of the unit of
measurements that Glue utilizes to charge its hourly rate? The name of the
unit is a DPU, or data processing unit, which allows you to process your jobs
and spreading out the demand of those jobs across multiple units. Also
remember the breakdown for your DPUs, as they are the way you measure
the cost per hour and the costs that are associated and potentially change
from region to region. All right, what about the standard application
programming interface, or API, that allows Java programs to access database
management systems? Again, when you are looking in these exam
questions, search for those keywords. The two keywords we need to take
away in this particular case are the API and Java. So, we know, from that,
that we're looking at JDBC, which allows you to connect to your database
management system to communicate only through Java-based programs.
And remember that your ODBC allows you to also connect to database
management systems, but they communicate with applications primarily
using C and C++. All right, and the final question that we're going to go over
in this particular module, which of the following best describes the type of
data found in traditional relational databases? Now, remember, when it says
traditional RDS, or relational databases, think structured data, which is in a
standardized format of columns and rows, which are easily accessed and
processed through AWS. All right, congratulations. You have completed this
module and the first step in your learning path to passing this exam. I am so
excited that you're starting this journey, and I'm really looking forward to you
passing your data engineering associates exam with flying colors.
Data Stores
Introduction to Amazon S3
Before we delve into storage classes, let's discuss the different scenarios of
data access because these will set the stage for understanding storage
classes. Scenario number one. You need to frequently access the data, and
the requirements entail low latency and high throughput. So this is the
equivalent of the relationship that I have with my mic. It's mounted on my
desk because I use it on a daily basis. I just need quick access and quick
retrieval. Scenario number two. You need to infrequently access the data,
and you're okay with slightly lower latency, but still require high throughput
once accessed. This scenario reminds me of my relationship with my camera.
I don't usually use it on a daily basis, so I store it in a not-so-close drawer
where it's easily accessible, but out of reach from the kids. This way, I can
quickly retrieve it with no hassle. Scenario number three. You need to archive
the data, but you don't mind the high latency, even if it takes up to several
hours to retrieve those items. Moreover, you also have the bandwidth to
tolerate low throughput, and that's my relationship with my studio gear. I use
these maybe once a year, so they're tucked in the fourth floor of my house in
a super high shelf. So to obtain access, I would need to grab a ladder from
the garage, climb the stairs while carrying the ladder all the way to the
fourth floor, and once there, I would need to set up the ladder, climb the
ladder to retrieve the gear. And for these listed scenarios, S3 offers three
primary storage classes. Amazon S3 standard-general purpose is ideal for
the first scenario where you're frequently accessing the data and need low
latency. Common use cases include websites, mobile and gaming
applications, as well as analytics for big data. Amazon S3
Standard-Infrequent Access is for the second scenario whereby the data is
accessed less frequently, but still requires rapid access once retrieved, and
because it's a downgrade from the general purpose option, it costs less.
Amazon S3 Glacier is great for archiving or backing up data and it costs
much less in terms of storage. There are two types of infrequent access. The
first is Amazon S3 Standard-Infrequent Access or S3 Standard-IA for brevity.
It offers 99.9 availability in multiple zones. Great use cases for this storage
tier include disaster recovery, given that it has a multi-AZ capability and
backups. The second is Amazon S3 One Zone-Infrequent Access or S3 One
Zone-IA for brevity. This option offers 99.5 availability in a single zone. It's
suitable for storing secondary backup copies, but not so much for DR which
relies on having redundancy across multiple availability zones. Now, let's
unpack S3 Glacier types where we've got three retrieval options for
accessing archived data. The first is the instant retrieval option which offers
millisecond retrieval support. This is great for scenarios where you're working
with medical images, news media assets, or data that needs to be accessed
on quarterly basis. The second is flexible retrieval delivery which entails
keeping the stored data for a minimum of 90 days before it can be either
deleted or transitioned to another storage class. Otherwise, you would pay a
fee for moving or deleting the data. It comes in three flavors, expedited
which returns data in a 1 to 5-minute window, standard which returns data
within 3 to 5 hours, and the bulk option which is geared towards scenarios
where retrieval times can be longer and less immediate, so something
between 5 and 12 hours. This option doesn't incur retrieval charges beyond
the storage fees. Lastly, the deep archive option. This one entails keeping
the data here for at least 180 days, so obviously, it's great for long-term
storage of rarely-accessed data. Retrieval options here include standard
mode where retrieval time is 12 hours, this is the default option, and the bulk
mode where retrieval time is 48 hours. Okay, so now that we've covered the
three storage classes, let's talk about S3 intelligent tiering, a unique storage
option that automatically moves your objects between the different access
tiers in exchange of a small monthly fee. So what are these access tiers?
First on the list, there's the frequent access tier. Intelligent tiering will
automatically place objects here by default, and objects remain in this tier as
long as they're being accessed. Infrequent Access Tier. Intelligent tiering will
use this tier to automatically place objects that haven't been accessed for 30
consecutive days. Archive Instant Acess Tier will be automatically used for
objects that haven't been accessed for 90 days. Archive Access Tier can be
optionally used for objects that haven't been accessed for anything between
90 and 730 days. Basically to configure this option, the minimum in activity
is 90 days and the maximum inactivity is 730 days. Lastly, we've got Deep
Archive Access Tier. This is another optional configuration that allows you to
configure intelligent tiering to move data that hasn't been accessed for
anything between 180 days to 730 days. Now, I think I said the word retrieval
at least a dozen times in this lesson, so let's quickly touch on a retrieval
option using what is known as S3 Select or Glacier Select. Basically, you can
use the S3 Select feature in S3 Select enabled storage classes, and most
storage classes support this feature with the exception of S3 Glacier. This is a
CSV file called top-apartments that I uploaded to a S3 bucket, and here is the
option to query my data using S3 Select. When I click on this option, it
prompts me to specify the input settings, so things like the format of the file,
the type of delimiter used to split the columns, the option to exclude the first
line, and whether or not the file has been compressed. The counterpart of S3
Select when it comes to Glacier Storage is Glacier Select. Both options will
allow you to run simple SQL statements to retrieve filtered data. So going
back to my S3 file, if I were to configure the input settings and run the
generated SQL statements, the result would look something like this. This
operation is quick because S3 operates the filtering operation directly on the
server where the data is stored instead of downloading the entire dataset to
the client. This is 400% faster and 80% cheaper compared to client filtering
methods.
Amazon S3 Security
So what comes to your mind when I say real estate or rental to be more
specific? Do you picture a high rise, perhaps your last Airbnb rental, or have
you been in this journey long enough to the point where you picture EC2
instances popping up in the cloud? As you might know by now, the traditional
way of obtaining physical servers is both expensive and time consuming.
Instead, EC2 allows you to rent virtual servers, also known as compute
instances in AWS. The whole process is streamlined and can be achieved on
a short notice because the process of renting such servers is as simple as
launching EC2 instances, either via the AWS console or through APIs. And
when you're done with the instances, you simply terminate them. And so
beyond the fact that it's so much easier, other benefits of EC2 include the
fact that you only pay for what you consume, send commitments, as
opposed to having to invest in long-term and restricting contracts that
usually go anywhere between 3 to 5 years. Moreover, EC2 is pretty flexible.
You can grow and shrink your instances based on your capacity as opposed
to having to calculate your predicted capacity ahead of time in order to
determine the exact number and size of servers needed for your mission.
Lastly, it only takes minutes to provision and launch an EC2 instance.
Whereas, it can take months to select, purchase, and ultimately provision a
physical server. One of the most critical aspects of picking an EC2 instance is
the instance type because the type determines three things. One, how
powerful your virtual machine is going to be. For instance, if you're dealing
with a basic block, you would need to pick a micro instance. However, if
you're working with, let's say, apps that need to handle heavier
computational tasks, you would need to pick a larger instance. Two, how
many virtual CPUs will end up in your application? For instance, an M5 large
instance provides two virtual CPUs, while an instance type like the C5 for
xlarge would offer 16 virtual CPUs. Lastly, the EC2 instance type will
determine how much memory will be provisioned to your application.
Examples of EC2 instance types include general purpose instances. Now,
going back to our three points from the previous slide in terms of power, they
offer a balanced performance of compute, memory, and networking
resources. In terms of virtual CPUs, they also offer a balanced ratio
respective to memory and a balanced ratio of memory to virtual CPUs.
Therefore, these type of instances are great for achieving a more balanced
performance for diverse workloads. Examples include the t3, t3a, and t4
instances. Next, we've got the compute optimized instance, these offer high
computational power, a higher number of virtual CPUs in contrast to
memory, all while providing sufficient memory that would support most
average workloads while still prioritizing CPU, so this balance allows it to
serve applications that demand a lot of computational power. Examples
include c6g, c5a, and c5n. Next, we've got memory-optimized instances
where in terms of power, these offer a ton of RAM while offering a lower
number of virtual CPUs compared to the other instance types. For memory,
as mentioned, these can be configured to meet the highest memory
capacities making them great for memory-intensive applications. Examples
include the r5, r5a, and r5n instances. Lastly, for storage optimized
instances, their power is the high speed storage. They, too, offer less virtual
CPUs while offering moderate to high memory making them ideal for
providing low latency storage requirements in data-intensive workloads.
Examples include l3, l3en, d2, and h1, and although storage optimized does
indeed mean more storage, it's important to note that local storage offered
by any EC2 instance is non-persistent, so don't confuse compute with actual
storage. When we say that storage here is not persistent, this means that
when you terminate an EC2 instance, all data stored on the instance will be
lost permanently. To persist data storage beyond the lifecycle of an EC2
instance, you can leverage additional storage solutions such as EBS or EFS
volumes or even S3 buckets. Now, let's delve into EBS. So EBS belongs to the
Block Storage category where volumes get attached to individual EC2
instances. Such AWS services include the instance store and Elastic Block
Storage. Instance store here is more like cash, so it's mainly meant for
enhancing performance, more so than being a permanent storage solution.
Whereas, an EBS is what you would need if you were mainly after preserving
the data beyond the lifecycle of the EC2 instance. This is usually used for
storing operating system data and application files. On the other hand, file
storage offers shared file storage, so instead of being associated with one
individual instance, it can be mounted by multiple EC2 instances
simultaneously. Such services include EFS for Linux and FSX for Windows.
Use cases here include content sharing. Picture a team of web developers
that are collaborating on the same website, and so they need to access the
same set of static assets. The second use case is distribution of files, so for
instance, distributing large media files across a geographically dispersed
user base. Now, let's talk about the different types of EBS volumes. We've
got the general purpose which is designed for a balance of price and
performance, usually used for small to medium size databases, provisioned
IOPS, which allows you to specify a consistent level of IOPS, so such
applications include transactional processing systems or real-time analytics.
Next, we've got the throughput optimized. It's designed for
frequently-accessed workloads such as big data analytics platforms like
Hadoop or Spark or data warehouses. Next, we've got the cold HDD. These
are designed for infrequent access. Lastly, the magnetic option is designed
for low-cost storage when you've got large amounts of data that you rarely
access. In terms of pricing models, EC2 offers four pricing models, on
demand which allows you to pay by the hour or the second, most instance
types billed by the hour or partial hour, while the ones with higher
performance capacity or specialized hardware billed by the second. Next, the
reserved model entails that you commit to a specific capacity for 1 or 3 years
depending on the contract. And in exchange, you get a 72% discount on the
hourly charge. The spot model allows you to purchase unused capacity at a
discount of up to 90 percent. Lastly, the dedicated model offers physical EC2
servers that are specifically dedicated for you, so obviously, it's the most
expensive option.
Data Formats
So I believe there are three organizational styles. The ultra organizer, take
my mom, for example, she's the Maestro of organization. She likes to align,
color code, and just have things marching in perfect rows. Then there's me.
My soul is always torn between chaos and order. So on good days, my closet
looks more like this. It's not a Pinterest-worthy type of closet, but it's not a
disaster zone either. Then there's me on hectic days. Any time I volunteer to
host an event or engage in a site project, my closet turns into what I refer to
as the Bermuda triangle of closets where everything in there just
mysteriously disappears, and guess what, data formats are just like us. Some
are structured just like my mom. Some are semi-structured like me on good
days, and some are unstructured like me on hectic days. So what exactly is
structured data? This is data that follows a predefined model or schema
through the use of tables, rows, and columns. The relationships between the
data elements are clearly defined, and so consequently, this data is easily
queryable. Simply speaking, just like my mom's closet, you walk in there and
immediately find what you're looking for. Examples include spreadsheets,
SQL databases, CSV files, and relational tables. Semi-structured data, as
mentioned, falls between the categories of structured and unstructured data.
It has some organizational elements, it follows a hierarchy through the use of
tags, keys, and attributes. At the same time, it doesn't adhere to a rigid
schema like structured data, so there is room for change, and you can think
of this using the closet analogy. So my closet is not too rigid, I can change it
over time. Unlike my mom's closet, which has like a ton of customized and
fixed compartments, so it would need to undergo a lot of drastic changes to
change over time. Having said that, hers is just easier to navigate through,
it's easy to go in there and retrieve and find items. So building on this
analogy, we can say that semi-structured data is less queryable than
structured data, but more queryable than unstructured data. Just keep in
mind that you might need specialized querying approaches compared to the
fully-structured data, so basically, just like my closet, it comes with its own
learning curve. Examples include JSON and XML. Lastly, unstructured data is
data that doesn't adhere to a specific schema because it's not organized into
a consistent format. It lacks clear relationships between the elements, and
consequently, is not easily queryable. Like just good luck retrieving anything
from my closet on those hectic days. Therefore, you need to do a bit of
preprocessing to analyze unstructured data. Examples include digital assets
such as images, audio, and video, social media posts, text files that don't
have a specific structure, and word documents. Now, let's explore a few
examples of common data formats starting with CSV, AKA, comma-separated
files that follow a tabular form that's similar to spreadsheets, and by looking
at one of these files, we can clearly tell that it falls under the structured
format umbrella. You can use CSV to exchange data between applications.
For example, you might export data from a database as a CSV file and then
import that CSV into another application. To interchange data in
programming tasks, such as reading and writing data files, so most
programming languages provide libraries to tackle CSV files. For example,
Python has the CSV module to read data from CSV files. Number three, to
perform quick data analysis tasks on small to medium datasets. Applications,
such as Microsoft Excel or Google Sheets, allow you to quickly analyze CSV
data and even turning it into charts or performing calculations. And you can
also use CSV to backup and archive data, especially when the data is
primarily tabular. For instance, you might configure your application to
export CSV files regularly and then have it stored in a secure location as a
backup. Another common format is JSON, which is text-based data that's
organized in a hierarchical fashion using key value pairs. Here is an example
of a JSON record. As you can see, it has key value pairs representing a
student's information. You can use JSON to configure files and settings. It's so
simple and readable. You can easily store these settings inside the keys and
associate the respective values accordingly. And values can have a variety of
data types. They can be strings, numbers, Booleans, arrays, objects, and if
needed, null. The simplicity of JSON also makes it great for exchanging data
between web servers and browsers, which makes it a common choice for
transmitting data in APIs. JSON is language agnostic, meaning that it doesn't
have language-specific dependencies. It works with all sorts of programming
languages, so it's great for applications that require high interoperability.
Lastly, similarly to CSV, JSON can be used for backing up and archiving data.
Next, we've got Avro which represents data in a way that is easy to serialize,
as in convert to binary and deserialize as in convert back to its original
structure. This is an example. Do you notice something? Doesn't it look
exactly like the JSON example? That's cause Avro has a JSON-like syntax. In
addition, Avro is also usually associated with a declarative schema that looks
something like this where as you can see, it defines the names of the fields,
as well as the data types of those fields. So when would you use Avro? One,
to achieve a compact binary format. Avro is designed for efficient
serialization which results in smaller payloads when you compare it to JSON,
which as mentioned is a text-based format. Two, Avro is great for big data
processing frameworks, such as Apache, Hadoop, Spark, and Kafka. For
example, let's say you're using Apache Spark to analyze data, Spark would
be able to easily read and process the data in Avro format because it knows
exactly how the data is structured thanks to the Avro schema that we just
saw in the previous slide. Three, you would use Avro for applications that
undergo regular schema changes. This can be done because Avro allows you
to add new fields and modify existing fields without breaking backward
compatibility. Lastly, you can use Avro when you need high interoperability
by ensuring that the data is consistent between different systems. To achieve
this, Avro supports data validation and strict typing, which means that fields
are constrained to follow specific data types. And lastly on the list, we've got
Parquet, which is an open source storage file format that's designed to store
data in columns. It's pretty similar to Avro, but unlike Avro which had
separate files for this schema and the data, Parquet combines both the
schema and the data into one file. You can use Parquet for tasks that require
data warehousing analysis for instance, analytical or aggregation queries,
given that the column-oriented approach optimizes these queries. Parquet
can be used with Apache Hadoop, Spark, Kafka, as well as Impala and
Redshift spectrum. Parquet is suited for applications that undergo frequent
changes. It's designed to modify without breaking backwards compatibility.
And lastly, it's suited for when you need selective reading. The
column-oriented design allows you to access subsets of columns. Both Avro
and Parquet are popular file formats that are widely used in Apache
ecosystems, given that both are well integrated with Hadoop, Spark, and
Kafka with the main difference being that Avro is supported by Impala, while
Parquet is optimized for Impala. Avro supports row-based storage, while
Parquet supports column-oriented storage. Lastly, Avro uses a JSON-based
schema to define the structure, while Parquet uses its own schema definition
language, which is not JSON-based.
Transforming Data Formats
So what is ETL without the ability to transform data? Which is why there are
several ways to transform data using Glue ETL. You can use Python Shell jobs
for quick manipulation of data. You can use Spark ETL jobs for transforming
data at scale, and PySpark or Scalar jobs for batch processing, as well as
stream processing. Python ETL jobs are suitable for simpler ETL tasks, so
mainly small datasets. It offers prebuilt libraries for transforming data to
other formats, such as from CSV to Parquet and vice versa. They have
libraries for aggregating data which can be used to generate reports and
libraries for reading and writing specific data formats. So for instance, you
can use the CSV module to read from CSV, the JSON module to read from a
JSON file, and so on and so forth. For a use case scenario, picture having a
CSV file containing a small dataset of customer data within an S3 bucket that
you need to read and later convert to Parquet. In this case, you can use the
CSV module to read the file and the PyArrow library to convert the data to
Parquet. If, however, your jobs require higher compute power, you can go
with Spark ETL jobs because Apache Spark is a powerful open source
distributed computing system. It's powerful enough that it can be leveraged
within Glue to perform complex transformations over large scale data. Such
Spark transformations include filtering data, this is when you select specific
records based on certain criteria, aggregating data, whether that's
calculating sums, averages, or counts across different datasets, and joining
data in a sense of combining information from multiple datasets based on
common keys. For this scenario, picture working with a large dataset of
ecommerce transactions in Redshift where you've been asked to extract the
data and then sum the sales across the products to identify the top selling
products. And so because we're dealing with a large warehouse here,
Amazon Redshift, this is where Spark ETL jobs come in. You can use them for
the aggregation piece, and if, let's say, you were also asked to convert the
output to Parquet, you can then leverage Python ETL jobs for the convergent
piece. Lastly, for batch and streaming jobs, you can use PySpark or Scala to
write jobs for both traditional batch processing, which is when you're
processing data in fixed size batches and streaming processing, which is
when you're processing data in micro-batches at regular intervals. For the
traditional scenario, picture owning a retail company where you need to
analyze sales data coming from your stores on a daily basis in order to
identify trends and patterns, and so you ask your store managers to send
you the sales data in CSV format at the end of each day. In this scenario, you
can use PySpark or Scala to read the CSV file into Spark dataframes and then
transform or aggregate the data accordingly. For the streaming scenario,
picture the same retail company, but now you need to analyze the real-time
clickstream data of your clients. Here, you can set up an Amazon Kinesis
Stream to produce regular micro-batches of the data, and then use PySpark
or Scala to ingest and process the streaming data in real time.
Databases
AWS purpose-built databases come in all shapes and sizes to cater to today's
diverse application needs, and one of the most robust and widely-used
options is DynamoDB. It's a NoSQL fully-managed non-relational database. It
supports both key value pairs, as well as document data, such as JSON,
HTML, and XML, so it allows you to easily adapt your tables as your
requirements change. But to grant you this kind of flexibility, it takes away
things such as the ability to perform joins and analytical queries. Also, access
patterns must be known ahead of table creation. It offers unlimited storage
size, it's super fast, we're talking about single-digit millisecond at any scale
kind of fast, and it offers microsecond latency if you use DynamoDB
Accelerator, also known as DAX. Simply speaking, DynamoDB is limitless in
terms of speed and scaling as long as you're okay with defining your access
patterns and letting go of certain capabilities. DynamoDB's notable features
include DynamoDB global tables. These allow you to replicate your data
across different AWS regions which enables you to provide fast and
responsive access to your users across the globe. Next feature is DynamoDB
Streams. This is a time-ordered sequence that captures all the modifications
you do to your database on an item level. It does this by maintaining a
time-ordered list of all the modifications made on your table. In terms of
scaling and availability, DynamoDB features partitioning capabilities that
enable you to scale your database seamlessly without much manual work on
your end, and it automatically replicates your data across three different
availability zones within a region, so this increases the availability and fault
tolerance of your database. Thanks to all these features, DynamoDB is ideal
for media and metadata stores, so its ability to seamlessly scale with low
latency makes it well-suited for storing and managing photos, videos, and
other media files. Retail and shopping experiences, these applications often
experience high traffic, especially during peak times such as sale events or
holidays, so DynamoDB's ability to handle millions of requests per second
makes it suitable for the high throughput requirements of retail applications.
Similarly, DynamoDB is suited for large-scale gaming platforms given that it
can handle the massive amounts of data in these applications. And beyond
these use cases, you can go for DynamoDB if you're dealing with online
transaction processing workloads, AKA, OLTP. Examples here include financial
transactions and the ecommerce platforms and gaming applications we just
talked about in the previous slide. You can also go with DynamoDB if you
need hierarchical data models since DynamoDB allows you to have a
schemaless structure. Examples here include employee directories,
department structures, and organizational charts. DynamoDB's autoscaling
features also make it great for fluctuating workloads. For instance, social
media platforms that have varying user activity levels throughout the day or
ecommerce sites with flash sales. Lastly, you can use DynamoDB for
mission-critical applications that can't afford any downtime. As mentioned,
DynamoDB is designed to offer high availability and fault tolerance, making
it suitable for applications that require continuous operation such as health
care systems and online banking applications. Now, let's unpack
DynamoDB's building blocks by comparing the NoSQL anatomy to the SQL
anatomy. First one is easy because tables are tables everywhere. Next, we've
got items which are the equivalent of rows or records in SQL. Attributes are
the equivalent of columns or fields in SQL. Pretty much the data elements
that you store in your table make up your attributes, and a unique group of
attributes will give you a single row which is a single item in NoSQL. It's also
worth noting here that a single item can't exceed 400 KB in DynamoDB.
Lastly, we've got primary keys. These can consist of one or two attributes,
they're mandatory, and obviously, they're the equivalent of primary keys in
SQL with the only difference being that primary keys in SQL consist of one or
multiple columns and they are optional. The other difference is that in
DynamoDB, you will be using your primary keys to retrieve the data. This is
why knowing access patterns is essential in our table design because we
need to have enough knowledge to be able to wisely select our primary keys
when creating the table. Now, let's picture an actor directory application that
has a list of actors along with their movies. It has an actor table consisting of
an actor column, movie column, the year a movie was released, and the
genre of the movie. In this example, something like that genre would
represent our key while the field, drama, would represent our value, hence
the naming key value pairs. And since this application revolves around actors
and movies, it makes sense to have a composite key consisting of both the
actor and movie attributes. So if I were to search by, let's say, the actor Will
Smith and the movie King Richard, I would get this single item which consists
of a group of unique attributes. So for example, the values 2021 and drama
are two different attributes that make up a part of our unique item. Now, let's
go back to features. The last feature we've got here is the time to live
feature. From a non-technical perspective, think expiry labels. Manufacturers
add expiry labels on products to inform consumers when to ideally throw
things away. Likewise, if you were to add a time to live attribute to your table
items, it will too act as a timestamp that will be used to tell DynamoDB when
to start getting rid of items. Behind the scenes, TTL compares the current
time to the defined TTL attribute of an item. If the current time is greater
than the item's TTL value, then the item is marked for deletion. And
DynamoDB automatically removes the expired item from the tables, as well
as indexes including local secondary indexes, or LCIs for brevity, and global
secondary indexes, AKA, GSIs for brevity, and it does so within 48 hours of
expiration. Now, you don't need to know a ton about indexes and types of
indexes for the exam, but if you're interested to learn more about local and
global secondary indexes, check out the link in the Resources section. What
you need to focus on though is the feature itself and how it works behind the
scenes, and when we say within 48 hours of expiration, this means that you
might end up querying data that's expired, but hasn't been deleted yet. To
avoid this, use the filter operations to exclude such items from your result
sets. In terms of use cases, you can use TTL as a mechanism to delete
sensitive data. This can be a requirement for a contractual agreement with
your clients or partners, or it could be a compliance requirement. For
instance, you might have an obligation to remove user's data after a year of
inactivity within the application. You can also use TTL to delete sessions or
event logs that are no longer necessary. This will help you reduce your
consumed storage and thus save you costs on the long run. Lastly, you can
also use it for debugging and analytics purposes. For instance, you can use it
to remove temporary logs once they're no longer needed, and for analytics,
you can use them to track usage patterns within specified timeframes.
One of the coolest things about accessing DynamoDB through the console is
the ability to interact with data right there on the spot without having to
install any client applications on your local machine. PartiQL Editor is one of
the tools that allow you to query DynamoDB through the console. It allows
you to use SQL-like syntax to interact with DynamoDB tables. And since most
developers are familiar with SQL, PartiQL simplifies the learning curve of
transitioning from relational to NoSQL databases. It supports common SQL
statements, such as insert, update, select, and delete, and as you can see at
the query results section of the screen, you have the option to obtain the
output in either a table view format or JSON view format. And aside from
using the DynamoDB console to access PartiQL, you can also access it
through the AWS command-line interface, through the DynamoDB APIs, and
even through NoSQL Workbench, which is a standalone graphical tool that
you can download and install on your local machine. So in a sense, this is
pretty magical given that all you need to do is type in simple SQL-like
language without having to worry about translating your queries into
DynamoDB operations because DynamoDB takes care of this translation
behind the scenes, except it's not 100% magical because your queries don't
always get translated to efficient DynamoDB API operations. To understand
this, let's take a step back and understand scans and queries. Scans are the
equivalent of doing a SELECT * from a table in SQL. The specific command in
DynamoDB is aws dynamodb scan --table-name. These are super expensive
because even if you use filter expressions to limit the number of returned
items, it still would introduce the consumption of your capacity units because
all it does is discard the filter data after having consumed it, and if performed
on a large table, it can use up your entire provisioned throughput in a single
operation, which is why it's wiser to use queries instead. Those operations
allow you to retrieve specific items in a table using the primary key. It uses a
similar syntax to the scan operation, but instead of the scan command, it
uses the query command. And so because the query command works on
targeting specific items, it consumes less throughput which then makes it
less expensive than scans. Now, let's switch back to PartiQL. How does one
prevent PartiQL statements from getting unnecessarily translated to scan
operations? Well, you have a few options, such as utilizing AWS IAM to deny
the scan operation altogether. You do this in the identity that's being used to
run the PartiQL statements. Another option is to create secondary indexes
and write queries that use these indexes. Lastly, it's a good practice to
regularly monitor the performance of your queries and analyze any full scans
that occur to catch issues early in the process.
Now, let's talk about the Redshift workload management feature. So picture
this, you're a cashier in a large retail store overseeing a single queue. While
the setup seems straightforward, it's not free of challenges. Occasionally,
customers with just a few items ask to pass ahead of those with giant carts,
and this causes a lot of delays, not to mention that it can get pretty dramatic
when a toddler at the back of the line starts having a meltdown when they
find out they won't be taking any of those tempting impulse items, and if this
wasn't frustrating enough, imagine discovering that not just one, but two of
your colleagues are sitting idle at their empty registers because none of the
customers know that additional checkout lines are open. To optimize this,
your manager comes up with a new system. So now, picture a similar setup
with a different configuration. Your colleague gets assigned the express
queue to handle transactions of 10 items or less, and your most patient
colleague is tasked with assisting families with young kids. This clears up
your queue and leaves you with customers that have more than 10 items.
Sounds pretty magical, doesn't it? Well, this is where Redshift workload
management comes in. Thanks to this robust feature, you can design a
system that prioritizes queries by categorizing them into distinct queues. You
can create a queue for long-running queries, one for short and fast running
queries, and WLM also allows you to categorize queues based on user roles.
For instance, you can have a queue that's specific for the data analytics
team. Lastly, by default, WLM includes a super user queue that caters to
critical system operations such as administrative tasks, system maintenance,
and troubleshooting activities. So the main purpose of WLM is to prevent
long queries from holding up short, fast-running queries or prevent ad hoc
exploratory queries from holding up, let's say, high-critical queries. To get
started with WLM, you would need to set it up through parameter groups.
AWS uses these database configuration parameters to control the behavior
and performance of your databases. AWS uses these parameters to allow
you to configure the behavior of your databases. Here is my Redshift
console. I'm using a custom parameter group called WLM parameter group to
configure and prioritize my queues. As you can see, the second tab here has
the workload management feature. This feature allows you to have up to
eight queues with each queue having its own concurrency level to determine
the number of concurrent queries. So for instance, if the concurrency level is
set to one, only one query will be able to run at any given time. If the level is
set to five, then five queries will be able to run at the same time, and so on
and so forth. There are two types of WLM modes. We've got the automatic
mode. If you're working with the default parameter group, you will get this
mode by default. If you want to switch to the manual mode, you would need
to create a custom parameter group. And so because I'm using a custom
parameter group over here, I see the option to switch to the manual mode
over here. However, it's worth noting that AWS recommends creating a
separate custom parameter group, even for your automatic WLM
configurations. Other differences between these two modes include that in
the automatic option, Richard takes care of managing the concurrency level
of each queue. It determines resource allocation, such as memory, based on
the workload. So if you have a demanding query, for instance, a query with
multiple hash joins between large tables, Redshift will lower the concurrency
value so that fewer queries run simultaneously. You also have the option to
customize what's known as the priority values to identify the relative
importance of each queue. You have six options to choose from. There's the
critical, highest, high, normal, low, and lowest. In contrast, in the manual
option, you need to manage the concurrency level yourself, whereby you can
have a maximum concurrency value of 50. This means that within a specific
queue, up to 50 queries can be executed concurrently at any given time.
Likewise, the sum of all concurrency levels for all user-defined queues also
have to be within 50, so this means that no more than 50 queries can run
concurrently within all the queues. And in addition to being able to create
your own queues, by default, Redshift will create two queues, one queues
that will have a concurrency level of five, thus enabling up to five queries to
run concurrently, and a predefined superuser queue with concurrency levels
set to one, so this means that only one query from the super user queue can
be executed at any given time.
Migrating Data
Migration versus transfer. Migration is more like moving houses, the entire
house is getting packed and moved. Transfer, however, is more like moving a
box or a parcel from one place to another. AWS DataSync is a transfer service
that transfers files and objects between on-premise and storage services,
such as S3. One of the key distinguishing aspects of the AWS DataSync
service is that by design, the data between the source and target is
constantly synced. This is great for ensuring data consistency and availability
in real time. The second transfer service is the AWS Transfer Family, which is
a set of fully-managed file transfer services that are suited for standard file
transfer protocols, such as SFTP, FTPS, or FTP. One of the key advantages of
this service is its ability to integrate seamlessly with existing authentication
systems, such as Active Directory, or LDAP. This ability enables users to
leverage their existing user directories and authentication mechanisms, and
that's it in terms of transfers, so let's segue to migration, starting with the
planning process. You can plan migration in AWS through the AWS
Application Discovery Service, which is a component of the AWS Migration
Hub. It's mainly designed to assist you in discovering your on-prem
environment. It does this by scanning your on-prem applications to gather
comprehensive information about your applications. This includes their
configurations, interdependencies, and resource utilization, which you can
then use to determine the optimal migration approach. Application Discovery
Service, AKA ADS, offers two types of assessments, agentless discovery,
which is remote. Remember when all schools turn to virtual learning during
COVID? I didn't think I could possibly appreciate school teachers anymore,
and the year of teachers orchestrating classrooms virtually took my
appreciation to a whole new level. Likewise, with agentless discovery, you
don't need to install anything on your machine. Instead, it uses the AWS
Agentless Discovery Connector that scans your network and infrastructure to
gather information about your servers, applications, configurations, and
resource utilization, such as CPU, memory, and disk usage. So this form of
assessment is great for situations where the installation of additional
software AKA agents is not possible, whether that's due to security or time
restrictions, given that it can take a bit of time to install agents manually. The
second form of ADS assessment is agent-based discovery, which deploys
lightweight software agents referred to as discovery agents in your system.
This is more like teachers being physically present in a classroom, so just like
on-site teachers, these agents are able to continuously monitor and collect
more granular and more real-time data, and just like in-person education,
this is great for scenarios when more control and customization are needed.
Now, let's head over to migration services where we've got the Application
Migration Service. It focuses on application-level migrations, so it's ideal for
re-hosting, AKA lifting and shifting applications running on physical servers,
virtual machines, or other cloud environments into AWS, and you can
achieve this either by migrating applications to AWS or by replicating data
from source to target. Either way, it offers minimized downtime. The stages
of the migration lifecycle here include discovery which involves discovering
the applications in the existing environment, and then once the applications
are discovered and you identify the scope and complexity of the migration
project, the planning stage kicks in. This involves developing a migration
road map, and then before performing the final migration, it's essential to
validate and test the migration process in AWS. You achieve this by setting
up a separate test environment that closely mirrors the target AWS
environment where the applications will be migrated. This process allows you
to simulate the migration process and validate the migrated applications
without affecting the production environment, and the best part is that you
get to do this before doing the final cutover. Next migration option is the
snow family. This family is composed of physical devices that specialize in
migrating large data volumes. When you have a significant amount of data
to migrate, transferring it over the internet would be time consuming if not
completely impractical due to limited network bandwidth, and that's where
this family comes in. It includes the Snowball device which is great if you
have at least 10 TB to migrate. The other member of this family is the
Snowball Edge device, which is also designed for when you have more than
10 TB worth of data. It provides onboard compute resources that enable you
to process your data. This means that the Snowball Edge device is not just a
storage device, it also has the power to perform computations on the data it
holds. This can include tasks such as data transformation, analysis, or other
processing tasks, and therefore, Snowball Edge is suited for complex use
cases where you need both large storage and compute capabilities. Last, but
not least, is the Snowmobile device which is great if you have more than 10
PB worth of data.
Data cataloging systems make a big portion of the exam. So what's a data
catalog system, and what is it used for? Well, just like the conventional
library, data catalog involves the systematic organization of books and helps
you discover, understand, and categorize library data easily. In compute
terms, data cataloging involves the systematic or organization of your data
assets, so in a sense, it's like a well-organized library for your metadata. It
provides all sorts of insights about the data such as where is the data stored,
so the location or path of the data, what's in the data? For instance, it would
tell you that a particular table is about customer sales and includes, let's say
columns, X, Y, and Z, who uses the data, which can give you insights on who
regularly accesses the information. It can even give you access patterns. For
instance, it can inform you that the sales department usually accesses the
customer's table, while the marketing team, let's say usually accesses the
campaign's table. How good is the data? This is usually referred to as data
quality. High quality indicates that the table undergoes regular validation,
has few missing values, and minimal duplicates or inconsistencies. How does
a piece of data relate to other data? This is also known as data lineage,
which helps you visualize where is the data being sourced from, and what
kind of transformational stages does it go through before hitting the final
destination? Examples of data catalog systems include the AWS Glue Data
Catalog and the Hive Metastore. So what is this catalog, this centralized
platform that organizes data built of? To answer this, let's list the main
components of a data catalog, one, metadata repository, two, search and
discovery features, three, data lineage, four, data asset descriptions, and
five, access and security. And we shall unpack all of these components
shortly, but first, let's discuss Apache Hive and the Hive Metastore. Apache
Hive is an open source data warehousing and SQL-like query language tool. It
allows you to create data warehouses on top of large-scale distributed
storage systems such as Hadoop distributed file system or Amazon S3. The
SQL-like language that allows you to query and analyze these distributed
environments is known as HiveQL. Hive integrates with EMR so you can
install and run Hive on EMR clusters. In terms of the data catalog
components, the Hive Metastore is the Hives Data Catalog and it stores
metadata about the tables, also known as Hive tables, the schema which
mainly consists of information about the columns and their data types,
partitioning information, and the storage location of the data associated with
each Hive table. Alternatively, if you don't want to rely on Hive's built-in
Metastore and prefer a cloud native catalog, you can leverage a Glue Data
Catalog to use as a Hive Metastore, which takes us back to data catalog
components. So let's discuss the data catalog components using the Hive
Metastore as an example. First component was the metadata repository. So
the Hive Metastore in this example, or any data catalog for that matter, acts
as a centralized repo that stores metadata for each dataset. Search and
discovery. Whether you're using the Hive Metastore or any other data
catalog, you should have the capability to search using database names,
table names, columns, and other attributes such as keywords. Tags and
annotations can also be used to provide additional context for search
capabilities. For data lineage, the Hive Metastore shows the flow of data from
its source and transformational stages all the way up to the final destination.
It also shows the relationships between data. For instance, the foreign key
relationships between columns in different tables. Next component was the
data asset descriptions. All tables in the Hive Metastore have descriptive
information, including the table's purpose, owner, and creation date. The last
component had to do with access and security, so basically information
about implementing access controls that ensure that only authorized users
can view, modify, or interact with the assets. Such information can include
access permissions both on the table and column level and security labels
that are used to categorize data based on confidentiality, all of which can be
queued and analyzed through the Hive Metastore. Now, let's segue to Elastic
MapReduce. EMR is designed for processing massive amounts of data,
commonly referred to as big data, which can be structured, semi-structured,
or unstructured. It's a fully-managed service, meaning that AWS takes care of
the underlying infrastructure, including provisioning, configuring clusters,
and managing resources. This enables users to focus on writing and joining
their processing applications to process large-scale data, given that they
don't have to worry about the operational details. In terms of scaling, EMR
allows you to scale the number of compute resources, also known as
compute nodes up or down based on your processing requirements where
you're only charged for the provisioned resources. And the magic of EMR lies
within its ability to use frameworks that can distribute and parallelize data
processing tasks for faster and more efficient processing. Such frameworks
include Apache Hadoop and Apache Spark. To better understand this,
visualize your EMR cluster in the form of a large warehouse that consists of a
team of workers coming together to process the inventory. The equivalent of
these workers is EMR's compute nodes. Each EMR cluster is made up of EC2
compute nodes that do the bulk of the work to process the inventory that's
received from vendors, and in the case of EMR, the data is sourced from a
storage system, whereby, this data gets transported to EMR clusters via the
Elastic MapReduce file system. Lastly, as mentioned before, the data catalog
system is compromised of the Hive Metastore or the AWS Glue Catalog if you
wish to go with that option.
It's demo time, so let's create a data catalog which, as you already know by
now, is a collection of virtual databases, tables, and other metadata entries.
To create one, you'll need at least one database, one table which you can
either create automatically via Glue crawlers or manually via the AWS Glue
Console or API, and regardless of which option you choose, you'll need a data
source to feed the table. We will use Amazon S3 for the sake of this demo.
Then once everything is created, you can retrieve the data via Amazon
Athena, Redshift Spectrum, or AWS Glue. We will use Athena for this demo.
And I want you to picture a hypothetical housing analytics application where
we will be creating a database for Manhattan's properties, and the source
data will be partitioned by neighborhoods, so let's switch to the source file.
This is what the source file that I'll be using looks like. It has six columns
pertaining apartments in Manhattan, price, the number of bedrooms, the
number of bathrooms, square footage, status, and address. This data is
partitioned by neighborhood, so I have two other files that are similar to this
one, whereby each one of these files represents a specific neighborhood in
Manhattan, and this particular file over here belongs to the East Harlem
neighborhood. Now let's head over to the console and jump over to Amazon
S3. I just used the service so it shows up over here, but you can also search
for it using the search bar, then click on it from the search results. Ahead of
the demo, I created the bucket manhattan-housing-analytics and created the
subfolders athena-output-results to host Athena's output results and
source-datafeed to store the source files. As mentioned, the data is
partitioned by neighborhoods, so I created three subfolders inside this folder
where I've got neighborhood=EastHarlem for the first partition,
neighborhood=Harlem for the second partition, and the
neighborhood=LittleItaly for the third partition, and I uploaded the respective
files to each one of these folders. If you wish to follow along, you can grab
these files from the link provided in the Resources section. The next step is
to navigate to AWS Glue. So using the search bar, I'll search for Glue and
click on it from the search results. First things first, let's start with building
the database. So over here, click on Databases, Add database. For the name,
I'll go with manhattan_insights_db and click on Create database. Here is our
database, so I'll click on it. Then we need to create our table. To do so, let's
try out AWS Glue crawler, so click on Add tables using crawler. For the name,
I'll go with manhattan_crawler, click on Next. It's asking if the data has
already been mapped to Glue tables. That's not the case, so I'll leave not yet
selected. To configure our data sources, click on Add a data source. The data
source is S3, so I'll keep S3 selected over here. To set the S3 path, click on
Browse S3 and navigate to our source-datafeed folder. Click on Choose. Now
it's complaining about the S3 path. I believe this is an error in the console
because all it takes is to just delete the forward slash, then type it back in
again for it to work. For the subsequent crawler once configuration, we will
only run this one time so it doesn't matter in our case, but you have the
option to crawl all folders with every subsequent crawl or to only crawl new
subfolders. It doesn't matter in our case, so I'll leave this as-is and click on
Add an S3 data source. The Classifier section helps us define how the files
are formatted, so click on Add new classifier. For the name, I'll go with
manhattan-csv-classifier, and for the type, I'll select CSV. Leave everything
else as-is and click on Create. The classifier has been successfully created, so
I'll go back to our crawler, hit Refresh, select the newly-created classifier, and
click on Next. For the IAM role, I need to create a new one, so click on Create
new IAM role. I'll call it Properties-Analyst, click on Create, I'll skip the
security configuration options, and click on Next. For the target database, I'll
select the database that we created earlier, and for frequency, I only want to
run this on demand, so I'll keep this as-is. Just keep in mind that minor costs
are associated with crawlers, so make sure not to set this frequency any
more than necessary. Click on Next. Review the summary page, which looks
about right, so I'll go ahead and click on Create crawler. The crawler was
successfully created, so I'll go ahead and click on Run crawler. This usually
takes a few minutes, so I'll pause and come back once the crawler is done
running. Alright, so the crawler is done running, the status has changed to
completed, so let's head to our table to make sure that it was created
correctly. Click on Tables, hit Refresh. Here is our table source_datafeed, so
as you can see, you use the same name as the folder in our S3 bucket, so
click on the table. It has the correct database, the correct location is set to
our S3 path, the classification is set to CSV, and the schema looks good. And
as you can see, we've got the neighborhood column set to be our partition
key. So everything looks good, and we're ready for the final step, and that is
retrieving data. So click on Actions, View data which will transfer us over to
Athena, so click on Proceed, and now in Athena, we see that the AWS Data
Catalog is selected underneath the data source, manhattan_insights_db is
our database, and here is our table with the correct schema and the partition
column. Inside the Query Editor, we've got the select query to retrieve the
data from the table, but before we can run this query, we need to set up the
path for the output results. It's also warning us here that no output location
has been provided. So to fix this, click on Edit settings, Browse S3, navigate
through our S3 folders, select athena-output-results, and click on Choose. Hit
Save, then go back to the Query Editor. Hit Run, and voila, here is our output
result, it has the correct data, correct schema, and the partition key set to
neighborhood. With this, we've come to the end of our demo. Don't hesitate
to reach out if you face any issues following along.
Both AWS Glue and Apache Hive are data processing frameworks that
provide capabilities for processing and analyzing big data in data lakes. AWS
Glue is a data processing framework that offers fully-managed ETL services.
They simplify processing from the ingestion stage and all the way up to the
loading stage. You can use AWS Glue to crawl the data which infers the
schema and creates the AWS Glue Data Catalog which you can then use to
transform and load the data to your target database, and all of this can be
done via defining ETL jobs either through the console or custom Python
scripts to get Glue to ingest the data from various sources. Afterwards, the
data cataloging piece comes in. This enables Glue to crawl the data to create
and organize metadata that's then used to facilitate the extract, transform,
and load process, whereby, the transform stage can be achieved through
either built-in functions or custom code that transforms the data and then
loads it into the target data stores and analytical platforms. Likewise Apache
Hive is engineered for data processing and analytics. It facilitates data
transformations through a SQL-like language. You can use Hive-QL to write
SQL queries to process and transform data stored in either the Hadoop
distributed file system or S3. In terms of transformation, Hive-QL allows you
to perform operations such as filtering, aggregation, joining, and many other
operations that you can use to transform large datasets, and just like AWS
Glue, for data cataloging, Apache Hive incorporates a robust centralized
metadata store, and in the case of Apache Hive, it's referred to as the Hive
Metastore. And though both platforms serve similar purposes in the context
of data processing and analytics, they differ in their architectures and
deployment models. For instance, AWS Glue runs in AWS as a fully-managed
ETL service, while Apache Hive runs on Hadoop clusters. Glue handles
everything from resource provisioning to scaling and maintenance, so you
don't need to worry about infrastructure when working with Glue. In contrast
setting up and configuring Hadoop clusters requires significant effort and
expertise. So here, you're in charge of managing and maintaining the
infrastructure. In terms of processing, Glue supports both batch and
streaming processing. This flexibility allows you to process data in real time,
as well as in batch mode. On the other hand, Apache primarily supports
batch processing only, making it less suitable for real-time analytics
scenarios. In terms of ETL job translation, Glue translates your ETL jobs to
extract, transform, and load the data in AWS. On the other hand, Hive
translates Hive-QL into MapReduce jobs that are then executed on Hadoop
clusters. Glue integrates with various AWS services such as S3, Athena, and
RDS, so this integration allows you to leverage the full capabilities of the
AWS ecosystem. On the other hand, Hive integrates with other components
of the Hadoop ecosystem, such as HDFS, YARN, and Hadoop MapReduce. In
summary, while both AWS Glue and Apache Hive are valuable tools for both
data processing and analytics, their differences in architecture, deployment
model, and features make them suitable for different use cases and
environments.
Change in databases is like the weather, you can try to predict it, but
sometimes you just have to roll with the storm. Similarly, when schemas
evolve, data catalogs need to roll with the changes by having corresponding
updates to their metadata. Therefore, there are different mechanisms for
updating data catalogs in AWS. The manual approach involves updating the
catalog using the Glue Console or by manually triggering the Glue crawlers
to rescan the data sources and update the catalog. The programmatic
approach can be achieved via AWS Glue APIs, AWS SDKs, such as Boto3 in
Python and ETL scripts such as the pandas or PySpark libraries in Python.
The automated approach is done by scheduling AWS Glue crawlers to rerun
periodically to ensure that your catalog is always up to date with your
schema, and you can also use AWS CloudFormation to automate the
deployment and update of data catalogs alongside other infrastructure
components. The most obvious way for evolving schemas is through
updating schemas. You can directly modify the schema by editing the table
while preserving the underlying data. Schemas also evolve through
partitions, so you can add or remove partitions by altering key value pairs. If
you're adding or updating a partition, you would need to update the
partition's metadata pertaining its location, format, or compression. For
instance, if you're adding a new partition based on the year key for, let's say,
the 2022 value, you'll need to specify the directory path where the data for
that partition will be stored, so this is usually an S3 path. Another way
schemas evolve is through updating tables, for instance, creating and
deleting tables, updating table properties and changing your table's
ownership, which refers to the AWS account or IAM role that has
administrative control over a particular table, so any of these changes would
alter your schema and entail a data catalog update. Lastly, indexes, which
are typically used to improve query performance. Playing with indexes will
alter your schema and will need to be reflected in data catalog. Now, let's
unpack the impact of schema changes. Let's say you delete columns. In this
case, you'll no longer be able to query those columns despite the fact that
the underlying data won't get deleted. In contrast, if you add columns, you'll
be able to query the new column in the query results, and to deal with
previously-extracted data, you can either populate the new columns with null
values, specify a default value, or populate the column using existing value.
Lastly, if you change data types, AWS will end up interpreting the column
according to its new data type which may result in data type conversion
errors or inconsistencies if the existing data cannot be cast to the new data
type, so it will be on you to clean such errors up, which takes us to the next
point, and that is the transformation piece. You can transform data via ETL
scripts. One form is custom transformations, think fancy custom closets that
are tailored to your needs. Custom transformations are user-defined
functions that you can create from scratch using Python or Scala. Then you
would package your script in the library, upload it to S3, and create an AWS
Glue job that references the S3 path of your package. These functions are
mainly meant for complex data transformations and for format conversion,
for instance, converting from JSON to AVRO and vice versa. The second form
of scripts is bundle transformations which are predefined functions, think
typical prebuilt out of the box type of closets, not the fanciest thing, but they
definitely do the job. You can configure these built-in operations through the
AWS Glue Console or Glue APIs, and these functions are typically used to
streamline common data processing tasks such as mapping, joining, filtering,
and aggregation. Examples of such bundle transformation operations, the
DropFields operation which allows you to remove specific columns from your
dataset. The DropNullFields operation, this one allows you to remove
columns from your dataset if all the values in those fields are null. Filter
allows you to filter rows based on specified criteria. Join allows you to
combine datasets based on common keys, so it's similar to SQL Join
operations. Map enables you to transform each record in your dataset using
a custom function, so you can use it to add, delete, or modify fields, as well
as perform external lookups to enrich the data. Lastly, we've got
ResolveChoice. This operation resolves ambiguities in dynamic frames, and
we'll visit dynamic frames shortly, but for now, you can conceptualize this by
knowing that it resolves issues when data inconsistencies arise. It starts by
identifying such ambiguities and allowing you to specify rules on how to
handle such inconsistencies. For example, picture having a price field that
doesn't always have the same data type. Sometimes it's a string, while other
times it's a float. Using ResolveChoice would allow you to provide guidance
across the board on whether the field should be converted to a string or a
float. Now going back to dynamic frames. So data frames and dynamic
frames are data structures that you're likely to work with when creating ETL
scripts. A data frame is a data structure that's composed of records as in
rows and columns. They're commonly used for batch processing tasks and
are mainly designed for structured data with defined schemas, so more like
relational tables and spreadsheets, but they can also handle semi structured
data and unstructured data to an extent. And in either way, in the case of
any schema changes, you would need to manually update the schema. To
work with data frames, you can use APIs that are provided by data
processing frameworks that support data frames such as Apache Spark.
Likewise, a dynamic frame is also a data structure, but it's composed of
dynamic records, so it's able to extend the capabilities of data frames.
They're specifically designed to handle semi-structured data. They support
nested data format such as JSON and XML, and they support schema
evolution without requiring manual intervention on your part. And given that
dynamic frames were introduced by AWS Glue, you can actually transform
dynamic frames using AWS Glue's built-in scripts. Lastly, another form of ETL
scripts is machine learning transformations. These are AWS Glue's
specialized operations that enable you to leverage machine learning
algorithms to perform various data processing tasks, such as deduplication,
records linkage, which refers to linking related records from different data
sources that refer to the same entity, and data quality enhancement. An
example of a machine learning transformation is the FindMatches operation.
It facilitates deduplication by identifying duplicate records. It does this by
determining the likelihood of two records representing the same entity
despite having variations in their attribute.
Conclusion
Summary
Nothing beats practicing exam questions to prepare for this exam. I highly
recommend that you go through a couple of practice exams. So to wrap up
this course, let's go over three sample exam questions pertaining the data
store management portion of the exam. The first sample question is about
data catalogs. It says, a data engineering team has been tasked with
creating and maintaining a central metadata repository to be accessed via
Amazon EMR and Amazon Athena queries, and the repository must also
include the schema and properties for numerous tables. Some metadata is
currently stored in Apache Hive, and a team needs to import this data into
the central repository. The main ask is which solution minimizes development
effort. The provided choices are as follows. A, deploy a Hive metastore on an
EMR cluster, B, utilize Amazon EMR and Apache Ranger, C, employ the AWS
Glue Data Catalog, or D, implement a custom metadata import solution with
AWS Lambda and Amazon S3. Now there are different strategies to go about
solving this question. One way is to exclude the choices that come with
development overhead. For instance, it's fair to assume that the Apache
Ranger plus Amazon EMR, Hive metastore plus Amazon EMR, or AWS Lambda
plus Amazon S3 would come with a lot of development overhead. Therefore,
it's fair to exclude the choices A, B, and D. Thus, concluding that AWS Glue
Data Catalog is the correct choice. It's a fully-managed service that offers
automatic metadata discovery, and it seamlessly integrates with both EMR
and Athena, thus, meeting all the requirements provided in the question. The
next question is about optimizing queries. The question reads, you've been
tasked with optimizing the performance of Amazon Athena queries. You
observe that the data files used by Athena queries are presently stored in
uncompressed .csv format. Additionally, you know that users predominantly
execute analytical queries and aggregations by filtering data based on
specific categories. Which approach will most effectively improve the
performance of Athena queries? The choices are A, convert the data from
CSV to JSON format and utilize Snappy compression, B, apply Snappy
compression to the existing CSV files, C, switch the data format from CSV to
Apache Parquet and utilize Snappy compression, and D, employ GZIP
compression on the existing CSV files. Here, we can utilize a different
strategy by identifying the only approach that can meet the needed
requirements. This happens to be Apache Parquet, along with Snappy
compression in this scenario. First off, Apache Parquet is great for analytical
queries, aggregations, and data warehousing tasks. Moreover, Apache is a
columnar storage format that supports the ability to select certain columns,
which is ideal given that the aggregations are done by filtering data based on
specific categories. Lastly, this choice includes applying Snappy compression
to the Parquet files which further reduces the storage costs and improves the
efficiency of the queries. So with this, we can right off the bat conclude that
C is the correct answer. The next question is about purpose-built databases.
A business utilizes an on-premise Microsoft SQL Server database to manage
financial transaction data. Monthly, the company transfers this transactional
data from the on-premises database to AWS. Recently, the company has
observed a rise in the cost of migrating data from the on-premises database
to on Amazon RDS for SQL Server database. Seeking a cost-effective solution
for data migration to AWS, the company aims to minimize disruption to
applications accessing the database. Which AWS service should the company
employ to fulfill these criteria? The choices are, A, AWS Direct Connect, B,
AWS Database Migration Service, also known as DMS, C, AWS Snowball, or D,
AWS Transfer Family. Again, let's approach this one by flagging the wrong
tools starting with the AWS Transfer Family. This is a fully-managed service
that's meant for file transfers, so we can exclude it given that it's not
designed for database migration tasks. Next, we can exclude AWS Snowball.
This is a physical AWS device that's primarily designed for scenarios where
transferring large volumes of data over the internet would be inefficient or
downright impossible. Lastly, it's fair to exclude Direct Connect, given that it
doesn't directly address the tasks of migrating transactional data. So
excluding A, C, and D leaves us with the AWS DMS option, which indeed
meets the criteria. It offers a cost-effective solution for migrating data from
an on-premise Microsoft SQL Server database to Amazon RDS for SQL Server.
It minimizes the disruption by its ability to continuously replicate from source
to target. This guarantees that the transactional data changes will be
captured and migrated in a near real-time fashion. Lastly, AWS DMS is
capable of transferring transaction data from on-prem to AWS on a monthly
basis, which was also one of the key requirements. And with this, we've
come to the end of our course. You've come a long way in your learning path,
and you should be proud of yourself. Until next time, remember, all gurus get
there one lesson at a time.
Introduction
Data APIs
Once you've collected your data, it will reside in a data lake or a data
warehouse. And often to process a subset of this data, you'll want to migrate
some of it to an S3 bucket or some other data store for further analysis.
We've already seen that extracting, transforming, and loading this data and
preparing it for analysis is a difficult technical challenge. And often before
this data goes for analysis, you'll need to ensure its quality. So how can we
ensure the quality of the data? And what if we want data analysts to be able
to apply no code or low-code transformations without having to write full ETL
jobs? Fortunately, AWS has a solution for this. It's a service called AWS Glue
DataBrew. Glue DataBrew is a visual data preparation tool which is designed
to enable non-technical data analysts to filter, validate, and transform
incoming data. DataBrew provides no-code solutions for data validation and
detecting anomalies in the source data, and it even has over 250 prebuilt
transformations that you can use to clean and normalize the source data. You
can also use DataBrew to visually map your data's lineage. Let's start by
looking at how you can validate data quality with Glue DataBrew. Glue
DataBrew will sit between your data lake or data warehouse and the S3
bucket where you want to stage your data. A data analyst will leverage Glue
DataBrew to define data rules. These rules will continuously be applied to
incoming data and will not allow that data to transfer to the staging bucket if
it doesn't meet the data quality rules. DataBrew will then alert the analyst
about the malformed data and the analyst can remediate the source data so
that it passes the data quality check. Similarly, your analyst can define and
reuse transformations. So if you need to normalize a data column or
potentially split a column into multiple columns, an analyst can use no-code
and low-code tools in DataBrew to apply those transformations. Once
transformed, that data will be transported to the staging S3 bucket. Let's
take a look at the most common types of data transformations in DataBrew.
You can remove or replace missing values. You can combine different
datasets, you can create new columns. Potentially you want to split a time
stamp into multiple year, month, day columns. You can filter data, select only
a subset of data that you want to analyze. You can do label mapping, which
involves mapping each of several categories to a numerical value, for
example. And you can aggregate data. The biggest thing to take away for
the exam is that any time a scenario mentions the need to perform and
automate data transformations or validation rules without writing code, you
should think about AWS Glue DataBrew. That's all for this clip on DataBrew.
When you're ready, please join me in the next one.
Apache Offerings
If you're taking this course, it's likely you fall into one of two camps. You're
either experienced in data analysis and processing with open-source tools
and you're interested in implementing these on AWS or you're experienced in
AWS and relatively new to these open-source tools. This is a lesson to help
you understand how different AWS services implement open-source Apache
applications. We'll take a look at the Apache application and then any
services that leverage that application or act as alternatives to that
application. Let's start with Apache Flink. Flink is a super popular data
analytics application for streaming data. And AWS has Amazon Managed
Service for Apache Flink. So if you're streaming data using Amazon Kinesis,
for example, you can stream that data to Amazon Managed Service for
Apache Flink for a live analysis before it reaches its final destination. As an
example, perhaps you have a fleet of IoT devices that are streaming data to
Amazon Kinesis Data Streams. This data can be streamed to Amazon
Managed Service for Apache Flink, which can provide live analysis or
automated events before storing that data in S3, for example. Apache Flink
is capable of doing streaming ETL, applying minor transformations to data
before it's stored. It can give you continuous metric generation, real-time
analytics, and interactive analysis of data streams. Another popular Apache
offering is Apache Airflow. Apache Airflow is a workflow management
platform. You can use it to orchestrate and monitor really complex workflows.
If you want to migrate workflows that are already configured for Apache
Airflow, you can use Amazon Managed Workflows for Apache Airflow.
However, for more robust support of AWS services and less overall
operational overhead, most of the time AWS would prefer if you used AWS
Step Functions. While Step Functions are ideal for tightly sequenced
workflows, there are other alternatives for Apache Airflow for specific use
cases. For example, AWS Glue workflows can be used specifically for defining
ETL data pipelines. And Amazon EventBridge can be used for event
processing. EventBridge can receive events from many sources and then
push events to many targets. You can also use EventBridge to schedule
events. As mentioned, Glue workflows are specifically for defining ETL
pipelines where you have multiple transformations and staging steps.
Apache Kafka is an open-source distributed event streaming platform that is
optimized for real-time data streams. Once again, if you're migrating existing
Kafka applications to the AWS Cloud, AWS provides the Amazon Managed
Streaming Service for Apache Kafka. However, if you are building something
from scratch on AWS, it may be much simpler to use the Amazon Kinesis
family of services. Apache Hive is built on top of Hadoop for data
warehousing. And if you want to leverage Hive, you'll be using Amazon EMR.
Hive helps you interact with petabytes of data by allowing users to read,
write, and manage data using SQL. Apache Spark, on the other hand, is used
to define transformations. Spark is an engine for large scale data processing.
It can be used to process big data in parallel using Amazon EMR or AWS
Glue. For AWS Glue, Apache Spark is used to define ETL jobs. In this example,
we crawl an S3 bucket to create an AWS Glue Data Catalog. We use AWS
Glue to transform data that is stored there. We then output this to a new S3
bucket, create a data catalog for that bucket, which can then be analyzed
with services such as Amazon Athena. Similarly, with EMR, we can intake
data, which can then be defined and managed using Apache Hive. Not only
can we intake data from AWS, but we can also intake data from external data
sources using AWS DataSync. Once our tables are defined, we can execute
jobs using Apache Spark. So I hope this clarified how different Apache
offerings are leveraged within the AWS ecosystem. I'll leave you with this
exam tip. AWS will tend to prefer their fully managed and integrated
offerings. So if there is a specific requirement for using open source or if
you're migrating existing open-source applications, you may want to use the
managed Apache services. However, in cases where you are building things
from scratch, using the fully integrated AWS services is more likely to be the
correct answer. Take a minute to review, and when you're ready, please join
me in the next lesson.
Analytics
Once you have isolated the data that you want to analyze, the next common
step is to create visualizations for that data. Amazon QuickSight is a service
that allows you to create and share visualizations from many different data
sources. When you provision Amazon QuickSight, you create an entire
serverless application where you can add users and share visualizations. So
your AWS account will have IAM users or IAM roles that give humans access
to your AWS resources. QuickSight will have an entirely different pool of
users which you can assign QuickSight permissions to. So in AWS, you may
have your architects and engineers, and then in QuickSight, you can give
permissions to administrators, data analysts, and business leaders to view
dashboards. Dashboards are a collection of visualizations, and you can give
different permissions to users to view different dashboards. In this example,
we have a car company that sells both gas cars and electric vehicles, so you
can create separate dashboards for each of these business units and give
permissions to view these dashboards to particular business leaders. Now so
far, we've only mentioned Athena and S3 as data sources for QuickSight, but
you can use many, many other data sources. Pretty much any relational data
source you can think of on AWS and even third-party data sources like
GitHub, Snowflake, and Jira can directly integrate with QuickSight for data
visualization. Now, in order for QuickSight to have access to your AWS
resources, it has to be granted an IAM role to be able to visualize that data.
One important nuance here is that when you want to grant QuickSight the
ability to visualize data from Amazon Athena, you will also have to apply a
role to grant that QuickSight application access to any underlying S3
buckets. This is a really common troubleshooting scenario with QuickSight
and Amazon Athena. Another common scenario you may encounter on the
exam is having to choose between Amazon QuickSight and Amazon
CloudWatch for data visualization. These have some things in common, but
they're really quite different if you know what to look for. So, Amazon
QuickSight allows you to create dashboards of visualizations with highly
interactive charts and diagrams. Amazon CloudWatch also allows you to
create dashboards and the visualizations are also interactive, although, not
quite to the same degree. QuickSight is optimized for business intelligence
data visualization, whereas, Amazon CloudWatch is optimized for cloud
resource monitoring and automation. QuickSight is AWS's business
intelligence service, and the tools provided by QuickSight are biased toward
making really visually appealing diagrams to be shared with business
decision-makers. QuickSight has a huge selection of visualizations, whereas,
Amazon CloudWatch has a very limited selection of visualizations. Another
big difference is that QuickSight is a separate application with a separate
user pool, whereas, with Amazon CloudWatch, you have to manage the AWS
permissions for the human users. Now that you understand the basics of
Amazon. QuickSight, please join me in the next one.
Visualizing Data
AWS provides many services to help you visualize data, and these services
range from collecting and processing data to storing and analyzing that data.
You can think of the services shown here as existing on a spectrum from data
preparation to data analysis. First, let's take a look at AWS Glue Studio. Glue
Studio is a visual interface to help you filter and transform data directly from
the AWS console. Using the visual editor, you can define your Glue pipeline.
Amazon Athena also has a visualization tool called Athena visual query
analysis. With visual query analysis, you can dig in to your query
performance. You can see each logical step of the query and how much time
it's taken. If your query needs optimization, you can use visual query analysis
to find the most impactful place to improve your Athena query performance.
When it comes to creating data analysis visualizations of your data, one tool
you can use is Amazon Redshift Query Editor. With version 2.0, you can
create visualizations directly from the query editor itself. This way, you can
create simple visualizations without having to provision an entire QuickSight
application. If you simply want an ad hoc visual or just a test to see that your
query is getting the results that you want, you can visualize the data in
simple visualizations such as line charts and bar charts. For more advanced
analysis and visualization, you'll want to use Amazon QuickSight. QuickSight
can connect to many data sources and create visualizations that are ideal for
sharing across your organization. On the exam, you may also be tasked with
choosing between different types of visualizations, and it's important to
understand the differences between common types of visualizations. First,
there are line charts, which are ideal for tracking trends over time. Bar charts
split your data into categories and show comparisons between categories.
Pie charts can help illustrate percentages or parts of a whole. And scatter
plots or bubble charts compare two or three dimensions, respectively. Scatter
plots just show dots on an xy grid, while bubble charts also change the size
or color of the dart to represent some other dimension. Funnel charts are
used to show stages through a process. A good example of this would be
tracking rates of customers visiting your site, putting an item in their
shopping cart, and then actually going through with purchasing the item.
Histograms show the distribution of values for a given dimension. And
gauges display a single metric like a key performance indicator. That's all for
visualizing data. This has been David Blocher. When you're ready, please join
me in the next one.
Conclusion
Summary
Congratulations. You're almost through this section of the AWS Certified Data
Engineer-Associate exam prep learning path. In this clip, we're just going to
quickly summarize everything that we covered in this course. First, we took a
look at Amazon AppFlow and how it can help you integrate your data
services with third-party data providers. Then we had a tour of Amazon EMR,
or Elastic MapReduce. EMR is a managed cluster for running big data
operations, and it takes care of a lot of the underlying infrastructure
management and security. You also have the option of using EMR Serverless,
where you don't have to define the number of nodes or the size of the
instances of those nodes. This allows you to eliminate cluster configuration
altogether, and all you have to do is define your runtime and any jobs that
you want to run. Sticking with EMR, we also learned the difference between
ephemeral and long-standing clusters. If your jobs are only running
periodically, you'll want an ephemeral cluster. Long-standing clusters should
really be reserved for jobs that involve streaming data or clusters that are
getting close to constant use or scenarios where super high performance and
immediate start up are a must. We learned about the EMR Hive metastore
and how you can leverage AWS Glue Data Catalog or services like Amazon
Aurora or RDS to create an external Hive metastore. We talked about Glue
DataBrew as a low and no-code solution to help data analysts filter and
validate data coming from your data lake or warehouse. On the exam, look
out for Glue DataBrew in scenarios where you need to perform and automate
data transformations in a low or no-code solution. We also talked about the
plethora of Apache open-source applications and their AWS counterparts.
While AWS offers managed services for Apache applications such as Airflow
and Kafka, they'll tend to prefer their AWS integrated offerings unless there's
a requirement for the use of open source. We also talked about EventBridge
and how it's used in event-driven architecture. It can also be used to
schedule automated actions to take place. But we also cautioned that
EventBridge can overcomplicate some architectures. You should always look
for the simplest solution to help you solve the problem at hand. We spent
some time talking about Amazon Athena, which is a serverless interactive
query service for analyzing data in S3 buckets. On the exam, you'll be tasked
with understanding how to optimize Athena queries. You should understand
how to partition your data, compress your data, and use columnar file
formats which are optimized for analysis. You'll need to understand that
QuickSight can ingest data from many different data sources and share data
visualizations across your organization. A common troubleshooting problem
involves giving QuickSight the roles necessary to access the underlying data
for an Amazon Athena query. In this case, QuickSight needs an IAM role both
to access Amazon Athena and the associated S3 buckets. We also talked
about different ways to visualize your data processing and analysis. AWS
Glue Studio is a visual editor in the console where you can view the flow of
your data transformations. Athena visual query analysis helps you visualize
and troubleshoot optimization of your Athena queries. The Redshift Query
Editor takes it a step further by allowing you to visualize query results
directly from the query editor. This is great for creating simple visualizations
without having to provision an entire QuickSight application. If you have
experience in data analytics, you probably are already very familiar with
these common types of visualizations. But if you're not, I highly recommend
you review each type of visualization and review their use cases. There are
many more types of visualizations, but these are the ones you're most likely
to encounter on the exam. We talked about Amazon Macie and protecting
sensitive data in S3. Macie continuously scans your S3 buckets and can alert
you if it finds sensitive data such as PII, or personally identifiable information.
And finally, we talked about CloudWatch Logs and the different ways you can
monitor and analyze CloudWatch Logs. CloudWatch can ingest logs from your
AWS services or custom application logs and sort these into log groups. You
can then enable anomaly detection on the log groups. You can dig into the
logs with CloudWatch Logs Insights or if you need long-term storage or more
in-depth analysis, you can export those logs to Amazon S3. This is great if
you need to do periodic analysis with tools like Amazon Athena. It's also a
more cost-effective option if you want to store your logs long term. For
real-time log streaming, you should consider Amazon OpenSearch Service.
This is the best option for real-time monitoring, analysis, and searchability of
CloudWatch logs. If you only need to respond to particular log patterns, you
can also use a subscription filter. A subscription filter can send an event to
Amazon Kinesis or AWS Lambda, for example, and help you respond to
events in near real time. Great work on making it this far toward your AWS
Certified Data Engineer-Associate certification. You're one step closer now,
and I have no doubt if you keep applying yourself, you can achieve this
coveted designation. So make sure you review any topics where you feel less
confident, and when you're ready, please join me in the next one.
If you've made it this far, it's probably time to start thinking about scheduling
that exam with AWS. But to make sure you're prepared, let's walk through a
few scenarios that you're likely to encounter when taking the exam. First,
how can you create a persistent, central data catalog for an EMR Apache
Hive metadata store with the least operational overhead? For this question,
your mind should immediately go to creating an external Hive metastore in
AWS Glue Data Catalog or Amazon Aurora or RDS. Generally speaking, AWS
Glue Data Catalog is the simpler and more effective solution here. Your
metastore remains managed by EMR for your Hadoop workloads, but Glue
provides a centralized catalog that's really easy to integrate with other AWS
data sources. Next, let's take a look at this one. You need to scan S3 buckets
across your data pipeline to make sure they don't contain PII. How can this
be achieved? The correct answer involves enabling Amazon Macie in your
AWS account. This is a great service to know for the exam as it appears as
the correct answer in a couple of scenarios and also can appear fairly often
as a distractor. So it's really important to understand the function of Macie.
Next, you're tasked to enable a group of non-technical data analysts
invalidating and enriching incoming data. The process should be easy to
automate once it's defined. What service can help accomplish this? For this
one, we're looking for a low or no-code solution because our data analysts
are non-technical and we need to be able to both validate and enrich
incoming data. Here, we're looking for AWS Glue DataBrew, which is
specifically designed for this scenario. Data analysts can use DataBrew to
define repeatable data validations and data transformations. Generally
speaking, anytime a scenario requests a low or no-code solution, you should
see if Glue DataBrew is a good fit. Here's the last one. Your company has
several applications sending custom CloudWatch logs to several log groups.
You need to aggregate data, monitor application logs, and set up anomaly
detection for these logs as they arrive in real time. How can this be
achieved? Here, the solution is going to involve Amazon OpenSearch.
OpenSearch is the best option for near real-time monitoring and searchability
of CloudWatch logs. I hope you enjoyed this course on data operations and
support for the Data Engineer-Associate certification. I wish you luck in the
rest of your learning journey, and I look forward to seeing you next time.
Introduction
Introduction
IAM Foundations
Hello, my name is David Bocher, and I'll be leading you through this course
on data security and governance for the Data Engineer Associate
Certification on AWS. In this section, we're going to be talking about the tools
and services that can help you limit access to data. Now, what do we mean
by access to data? Well, you may have a database, and there are many
different types of principles that may want to access the data in the
database. You could have AWS services, applications, or human users that
want to achieve access to your database. Now, I'm using RDS as an example
here, but you can really think of this as any data service on AWS. Throughout
this course, we'll be peeling apart the layers of security and governance that
you can use to help protect your data. Now, it's important to understand for
the Data Engineer Associate Certification, you need to understand how to
access data from different perspectives. You may need to give some users
very limited access to data, while other users need to be data
administrators. As an AWS Data Engineer, you'll need to understand how to
achieve either perspective. So let's start by taking a look at IAM, or Identity
and Access Management. This is the cornerstone to achieving access to any
AWS service. The resource, application, or user that's trying to access your
AWS services is called the principal, and these principals will be granted
permissions to access resources. The service that allows you to grant
principals access to resources is IAM. And it's important to note that
principals can access resources in different ways. Human users can use the
AWS Management Console or the AWS CLI, and applications and AWS
services will be using the AWS API to access resources. The way principals
are granted access to resources is through IAM Policies. Without an IAM
policy, principals cannot reach resources. An IAM policy can either be an
identity-based policy attached to the principal, or it can be a resource-based
policy attached to the resource. If either of these policies grants access to
the principal, and neither of them denies access to the principal, then the
principal will be allowed access to the resource. Let's take a look at how IAM
policies are evaluated. First, IAM will check does any policy, the
identity-based policy or the resource-based policy, have a deny rule? If either
policy denies access, then access will be denied. Then it will evaluate if
either policy has an allow rule, and if at least one policy has an allow rule for
the action taking place, then access will be allowed. IAM policies are stored
in the JSON file format, and they look something like this. Take a moment to
look at this policy and think about what it might do. In this case, it allows
three different actions. You can either put objects into, get objects out, of or
get the object versions of objects in our example bucket. And this is an
identity-based policy, which means it would be added to an IAM user or role.
Let's take a moment to explore IAM users. IAM users are a way to map
permission sets to human users. In this case, we may have a data engineer
permission set, and we'll apply it to the IAM user, which is a data engineer.
We'll have a separate permission set for data administrators, which will be
applied to the datastore administrator. Now, if you only have two people
working in AWS, this may work, but most organizations have many, many
more. So, they might use IAM groups. Instead of applying permission sets to
individual IAM users, you can apply permission sets to IAM groups and assign
users to those groups. That way you can change the permission sets for a
group of users all at once without having to do them one by one. Now, if
you're just using IAM users and groups, you may run into a problem, and that
problem involves giving programmatic access to users. You see, when you
give AWS CLI access to users, you create a static access key and secret
access key that that user has to store on their local machine. If those access
keys are leaked or somehow acquired by bad actors, then the bad guys
would have all the same access as the data engineer in this scenario. This is
how a lot of data breaches happen on AWS. The solution here is using IAM
Identity Center. With Identity Center, you don't map permission sets directly
to users or user groups. Instead, you map permission sets to IAM roles. And
through single sign-on, the data engineer will be able to temporarily access
this data engineer IAM role anytime they log in. They can generate
temporary access keys for the length of their session for CLI access. Avoiding
long-lasting access keys is always a good idea, and IAM Identity Center
simplifies this process quite a lot. Now, you may already be familiar with IAM
roles. IAM roles are used by AWS services and applications to temporarily
assume privileges to access AWS resources. So not only can human users
use IAM roles through IAM Identity Center, but AWS services and applications
will do the same to access those resources. I hope you'll join me as we
continue to peel back the layers of data security on AWS. This has been
David Blocher, and when you're ready, please join me in the next lesson.
Let's take a closer look at how Lake Formation can help you achieve super
fine-grained permissions. When you set up a data lake with Lake Formation,
you create a data catalog. This helps you pull data from multiple sources and
break it into databases and tables that you can access with analytic services
and further transformations. With Lake Formation, you can give principles
access to particular tables within your data catalog. For even more
fine-grained access control with Lake Formation, you can add filters. There
are a few different types of filters that you can use in Lake Formation. Filters
are defined at the table level and allow you to give custom fine-grained
access to different users. Let's see what this looks like. One type of filter you
can do is a column masking filter. Say you have a table of item orders and
you want to mask the shipping address for certain users. You can add a filter
to this table, which excludes the column shipping address. Similarly, you can
use an expression to filter out certain rows. So say you have an analyst
whose job it is to analyze all of the orders that are placed from the US. Well,
you can do a row filter expression to only allow access to the rows that
contain that value in the country column. These types of filters can be
combined to achieve cell-level security. You can conditionally mask individual
cells from certain users. So if there's any case where you need to aggregate
data and achieve cell-level security Lake Formation is likely part of the
answer. Now, one thing I want to make really clear here is that filters are
applied at the table level, and then when you give users access to a table,
you can apply one or more filters to those users. For instance, you may use
the US sales filter to grant access to a US analyst. Perhaps there is a Canada
filter to give an analyst access to only data for Canadian orders. These can
be granted to individual users or groups of users. That's all for this lesson on
Lake Formation granular permissions. This has been David blocker and I'll
see you in the next one.
Another way that we can protect our data in AWS is through the use of
encryption. To put it simply, encryption is a way that you can scramble your
data such that only particular entities can access the unscrambled secret
data. When data is encrypted, one or more encryption keys is produced, and
only entities with access to the correct encryption keys can unencrypt the
data. Now, there are a couple different types of encryption that you should
be aware of. The first thing I want to talk about is data at rest versus data in
transit. If data is sitting in an S3 bucket or on an EBS drive in EC2, that data
is considered at rest. The same goes for any data on the hard drive on the
computer or device you're watching this on right now. However, we also have
to be concerned about the encryption of data in transit. Data in transit is
almost universally encrypted using TLS, or transport layer security. That's the
protocol that's used whenever you access a web resource using HTTPS. Now,
when it comes to encrypting data at rest, there are a couple different ways
you can achieve this. You can use client-side encryption or server-side
encryption. If you use client-side encryption, the application that is sending
the data will apply encryption before the data is sent. The encrypted data
travels across the internet and ends up in S3. This is really secure because
unencrypted data never even leaves the application where it originated from.
However, the application is still responsible for managing the encryption key,
which is a bit more complicated. Another option is to use server-side
encryption, where data is sent across the internet in its unencrypted form,
and once it reaches S3, it will be encrypted with an AWS managed key. This
is a solution that requires a lot less operational overhead. And as long as
you're encrypting that data in transit, it should never be exposed to the
public internet. Now, when it comes to S3, you have a couple different
options for server-side encryption. You can use S3 managed keys, which is
enabled by default. You can use KMS keys if you need more granular access
to key permissions. Or you can use customer-provided keys. You might need
to use this option if all of your encryption keys must be managed
on-premises. Let's take a more detailed look at these different types of
encryption. First, S3 managed keys. Again, these are enabled by default, and
it's super secure because each object in the S3 bucket is encrypted with a
unique key. This uses 256-bit advanced encryption standard, and when
putting objects to an S3 bucket, you'll need to include a header that looks
like this. You might choose to encrypt your S3 objects with KMS keys. If
you're using KMS keys, you can view and edit the key policies for individual
keys. KMS also makes it a bit easier to follow individual key usage in
CloudTrail. If you're using KMS to put an object in S3, you'll need to include
one header that defines KMS as the type of server-side encryption being
used, and you'll also need to supply the key ID for that particular object.
Using customer-provided keys is the most complicated option and should
really only be chosen if it's a security requirement for your application.
Customer-provided keys give you full control of encryption keys, and these
keys can be managed on-premises, on an application hosted in AWS, or a
different cloud provider. When you're creating an object by API using
customer-provided keys, you'll include the encryption algorithm being used,
as well as the encryption key itself in base64. It's important to note that if
you ever send this header over an unsecured network, you should consider
your key to be compromised. Next, let's talk about encrypting data in
Redshift. With Redshift, you'll likely be encrypting your data using KMS, and
you can use AWS-managed keys or KMS customer-managed keys. One really
important detail to note is that you can't encrypt a Redshift database without
affecting its performance. You either have to choose to encrypt it upon
launch, or you migrate it to an encrypted cluster by changing the encrypted
database option. AWS still manages this migration, but you may experience
some downtime as the migration takes place. For AWS Glue, you have a
couple different considerations for encryption. First, as you receive data from
your data sources, you're going to want to make sure that these are
encrypted in transit. You can configure AWS Glue to only access data stores
through a trusted TLS protocol. Then there's all the data at rest, including
your Glue data catalog and data stored in S3 buckets. These will be
encrypted using KMS or S3-managed keys. When it comes to granting access
to encrypted data, it's important to know that the principles that wish to
access your encrypted data at rest not only need the permissions necessary
to access the data, but they're also going to need the permissions to encrypt
and decrypt data from those data sources. That's all for this lesson on data
encryption. This has been David blocker and when you're ready, please join
me in the next lesson.
One scenario you may encounter around data security and governance on
the Data Engineer Associate exam is sharing data across Redshift clusters.
These Redshift clusters can exist within the same AWS account, or you could
potentially need to share data across accounts. In either case, you're going
to be using a Redshift datashare in order to share this data. A datashare can
consist of one or more database, table, user-defined function, materialized
view, or schema. First, you define which Redshift objects will be shared, and
then you share it with a particular Redshift cluster. When deciding which
Redshift cluster to share your data share with, it's good to know that you can
share across cluster types, you can share across availability zones or regions,
and you can even share datashares across AWS accounts. Let's take a look at
what this would look like. So here we have some commands issued in the
Redshift console. You would create and name your datashare. Here, we add
the public schema, which is the default schema of any cluster, and then we
add the sales table. Finally, once we've added objects to our datashare, we
can grant usage of the datashare to a particular Redshift cluster. Once you've
granted usage, Cluster B will have read only access to all objects placed in
the datashare. And there's no need to refresh the datashare to give
up-to-date data; it will automatically read the live data from Redshift Cluster
A. That's all for this short lesson on sharing data across Redshift clusters.
This has been David Blocher, and when you're ready, please join me in the
next lesson.
Conclusion
Summary
All right, congratulations! You've made it to the end of this course on Data
Security and Governance as it pertains to the Data Engineer Associate exam.
Let's take a moment to review the major subjects that we covered
throughout this course. In this course, we peeled apart the layers of data
security and governance on AWS. We talked about how to implement and
troubleshoot the different layers of data security. Remember that data
security and governance takes up 18% of your total score on the Data
Engineer Associate exam. While this is the smallest domain on the exam
guide, it's still crucial to understand data security and governance inside and
out for implementing data solutions in the real world. The first thing we
talked about was IAM, or Identity and Access Management. This is the
backbone of all access management on AWS. With IAM, you grant principals
access to resources, and you do this either with identity-based policies, or in
some cases, resource-based policies. When you grant people access to your
AWS resources, they can take actions using the AWS Management Console,
the AWS CLI, or programmatically using AWS APIs, or the AWS Software
Development Kit. Next, we talked about network security. Specifically, we
talked about how to grant network access to private datastores and how to
give private compute access to datastores. We talked about how to
troubleshoot connection between a private database and a private instance.
You need to make sure that there is a route in the route table. Then you need
to make sure the NACL, or the network access control list, does not restrict
this traffic. Then you need to make sure each security group has a rule
allowing traffic from the other. In the case of the database, you need to make
sure that the security group allows inbound traffic from the instance, and the
instance security group allows outbound traffic to the database security
group. If you're certain you've provisioned the correct IAM rules and there's a
route to your private datastore, there's a good chance that security group
rules are the reason your connection is timing out. After we went over
network security, we talked about authentication. Sometimes you need more
than just IAM to authenticate with a data source. For RDS, you can use IAM
authentication, Keberoes authentication, or password authentication. You
aren't likely to run into Kerberos authentication on the exam, but for
password authentication, you are definitely going to need to know about
Secrets Manager. Secrets Manager can help you encrypt, and, most
importantly, automatically rotate database credentials that you store. You
may be tasked with choosing between Secrets Manager and Systems
Manager Parameter Store. While Parameter Store is a bit cheaper, Secrets
Manager tends to be the most secure. It directly integrates with RDS and
should be considered the best option for encrypting and programmatically
accessing secrets. We also talked about encryption and the different services
you can use to encrypt S3 and other datastores. For S3, you can use
S3-managed keys. You can use KMS keys, which are either AWS or
customer-managed, or you can bring your own keys. For Redshift, you'll be
using KMS, either AWS-managed or customer-managed keys. The important
thing to know here is you either have to encrypt your Redshift cluster upon
launch, or you can migrate it to an encrypted cluster. AWS handles this
migration, but you may experience some downtime as the migration takes
place. We also talked about fine-grained security, row-level and column-level
security. This can be achieved in data lake using row masking. You can also
do column masking and even cell-level masking. And in Redshift, you can
mask whole columns when granting select and update privileges, and you
can mask whole rows by applying RLS policies to individual users or groups.
Redshift also allows you to do dynamic data masking of columns where you
can transform or partially mask the data found in a column. For monitoring
and logging, we talked about CloudTrail and CloudWatch. For CloudTrail, it's
considered a best practice to consolidate your CloudTrail logs in a single
security account. This allows you to really limit access to that account so
those buckets can't be tampered with or the data accidentally deleted. And
you can still analyze these logs centrally using analytic services like Amazon
Athena. For CloudWatch, you can do near real-time analysis of application
logs by sending those logs to log groups and then streaming events from
those log groups to different AWS services. You can subscribe services to log
events at the account level or the log group level, and you can filter the
events from these log groups up to two filters for an event log group and one
filter if you're doing it at the account level. You're now one step closer to
sitting and passing the AWS Certified Data Engineer Associate exam. Keep
the momentum going, and please reach out and let us know when you reach
that shiny new certification.
Before you move on from this course, I wanted to go over a few topics you
might see on the Data Engineer Associate exam. I've prepared a few
challenges to help you gauge if you're ready to move forward, or maybe if
you need to go back and review some lessons and documentation from
earlier in the course. Let's start with this scenario. You are trying to connect
an EC2 instance to a private RDS instance. You verified that the routing and
IAM permissions are correct. What is the likely issue? Knowing how to
troubleshoot routing to a private RDS instance can earn you quite a few
points on the exam. You need to verify that both the security group and the
NACL allow database traffic across your network. The likeliest culprit is the
security group. The database security group needs to allow inbound traffic
from the EC2 security group, and the EC2 security group needs to allow
outbound traffic to the RDS security group. Next, your Redshift database
contains personally identifiable information that should not be exposed to
analysts, but it can't be removed from the data warehouse. How can you
give analysts access to the database? Most likely you'll mask columns when
granting those analysts access to the database. You also have the option of
row-level security using RLS policies. And in some cases, you'll be using
dynamic data masking, depending on whether or not you need some portion
or a transformed version of the data to be visible. You are required to encrypt
data at rest in your organization's S3 bucket. However, you are also required
to have control over encryption keys and their associated key policies. How
can this be achieved? So, we know the options for S3 are S3 managed keys,
KMS keys, and customer-provided keys. S3 managed keys don't give you
access to the key policies, so you can meet the requirements of the scenario
using KMS or customer-provided keys. However, customer-provided keys are
going to be more complicated, as you don't get to offload some of that
operational complexity to AWS. KMS is a great solution in this scenario
because you get access to those key policies, but you don't have to fully
manage the encryption keys. Finally, data engineers that manage a Redshift
cluster in another AWS account need access to a materialized view from a
Redshift cluster that you manage. How can you share that materialized view
without giving those data engineers access to your cluster? This is a perfect
scenario for datashares. You can create a datashare, add the materialized
view to the datashare, and then provide that read-only access to the other
Redshift cluster, even across accounts, regions, or different cluster types.
This will give them live, up-to-date data just as it appears in your Redshift
cluster. I hope you found this exam review useful. And with that, we've
reached the end of this Data Security and governance course. You should be
really proud of yourself for making it this far, and I hope you're excited for
whatever is next on your learning journey.
The second domain for the data engineering certification is data store
management. And once again, let's warm up before diving into the sample
exam question. The first question is, which of the following services is a
general purpose data storage on AWS, Amazon EC2, Amazon S3, Amazon
RDS or AWS Lambda? Amazon EC2 provides resizable compute capacity in
the cloud. From a storage perspective, while EC2 instances can have
attached storage such as EBS volumes and the instance store, their primary
purpose isn't for general purpose data storage, but rather for running
applications and processing data. RDS is a fully managed relational
database. In terms of storage, while RDS manages relational databases, it's
mainly optimized for transactional and relational data rather than being a
general purpose storage. Lambda is a serverless compute service. It allows
you to run code without provisioning or managing servers. In terms of
storage, it doesn't provide persistent storage for general purpose data. In
contrast, Amazon S3 is indeed a general object storage service. It's designed
for storing and retrieving any amount of data from anywhere on the web. So
going back to our question, Amazon S3 is the correct answer. The next
question is, which of the following file formats is not typically used for storing
data in S3? Is it JSON, XML, YAML, EXE or Parquet? Questions on different file
types usually come up in the exam, and it's one of those things that you can
easily score if you understand the different uses of these types. To answer
this question, let's review the file formats. JSON files are lightweight files that
are easy for humans to read and write. They're also easy for machines to
parse and generate. Therefore, they're usually used for APIs and
configuration files. XML is a markup language that defines a set of rules for
encoding documents in a format that is both human and machine-readable.
So similar to JSON, but a bit more verbose. YAML is also human-readable. It's
a data serialization standard often used for configuration files. YAML enables
you to create complex data structures with simple syntax. And as you might
already know, EXE stands for executable files. If you've ever worked with a
Windows machine, you'll probably be familiar with the process of
double-clicking an executable to install a program on your machine. Lastly,
Parquet is a columnar storage file format designed for efficient data storage
and retrieval. It's a binary file format, so it's not human-readable. And all of
these files are likely to be stored in S3, except for executable files. Of course,
this is a super trivial question, but it goes to say that you need to understand
the ins and outs of each file type to determine which file to use, depending
on any given scenario. Next question is which of the following databases is a
fully managed NoSQL database in AWS? Is it Amazon Aurora, Amazon
Redshift, RDS or DynamoDB? To determine the fully managed NoSQL
database, let's quickly review each service. Aurora is a fully managed
relational database service that's compatible with both MySQL and
PostgreSQL. So it's not a NoSQL database. If anything, it uses SQL to manage
and query relational data. Amazon Redshift is a fully managed data
warehouse designed for large-scale data analytics, so definitely not intended
for NoSQL workloads. RDS, like Aurora, is designed for SQL databases. And
technically speaking, Aurora is one of the engines offered by RDS. This
leaves us with DynamoDB, which indeed is a fully managed NoSQL database
service. So when a question has a NoSQL requirement or requires some
schema flexibility, this is your cue to go with DynamoDB. And so here, the
correct answer is Amazon DynamoDB. Which S3 storage class is the most
cost effective for infrequently accessed data, Standard S3, S3
Intelligent-Tiering, S3 Standard-IA or S3 Glacier? To answer this, let's review
access tiers. Standard S3 offers high durability and availability with no
retrieval fees. So it's ideal for frequently accessed data. However, it does
offer higher storage costs compared to S3 Standard and frequent access.
Therefore, it's less cost effective for infrequently accessed data. S3
Intelligent-Tiering automatically moves data between the infrequent and
frequent access tiers to optimize costs based on the changing access
patterns. It's a great feature, but it does incur an additional fee for
monitoring and automation. So unless you're working with an unpredictable
workload, you're better off selecting a specific access tier. S3 Standard-IA
provides low storage costs and quick access for infrequently accessed data.
It does this while maintaining high durability and availability. Just keep in
mind that it charges retrieval fees and requires a minimum storage duration,
making it less suitable for frequently accessed data. Lastly, S3 Glacier
provides extremely low storage costs for long-term data archiving with high
durability. However, given that retrieval times can range from minutes to
hours. it's not suitable for scenarios that require quick access. Therefore, for
infrequently accessed data, the correct answer is the S3 Standard-IA tier.
Next question, which S3 feature helps prevent accidental data loss by
keeping multiple versions of an object? Is it S3 Transfer Acceleration, S3
Replication, S3 Versioning or S3 Lifecycle Policies? S3 Transfer Acceleration is
designed to speed up the transfer of files to and from Amazon S3 using
CloudFront's globally distributed edge locations. And it doesn't have any
functionality related to versioning or preventing data loss. S3 replication
allows you to automatically replicate objects and their metadata across
different S3 buckets. You can do this within the same AWS region or across
different AWS regions. And while it enhances data durability and availability,
it doesn't keep multiple versions of an object to prevent accidental data loss.
In contrast, S3 versioning helps prevent accidental data loss by keeping
multiple versions of an object in the same bucket. When this feature is
enabled, S3 preserves existing versions of objects whenever they're
overwritten or deleted. Lastly, S3 Lifecycle Policies manage the lifecycle of
objects in S3. They allow you to transition objects between different storage
classes or to delete them after a specified period. And while useful for cost
management and data retention, they don't keep multiple versions of
objects. Therefore, the correct answer is S3 Versioning, given that it enables
you to recover from unintended changes. Next question, which of the
following does not support transaction processing? Is it Amazon Redshift,
Amazon RDS, Amazon Aurora or Amazon DynamoDB? In other words, which
one of these is not designed for OLTP, i.e. online transaction processing, and
which ones are designed for OLAP, aka online analytical processing? So let's
go over these services. Amazon Redshift is a data warehouse service
designed for large-scale data analytics and reporting. While it can handle
SQL queries and support some transactional capabilities, it's primarily
optimized for read-heavy analytical workloads rather than transaction
processing. In contrast, Amazon RDS supports transaction processing, as it
can manage various relational database engines such as MySQL, PostgreSQL,
Oracle or SQL Server. All of these engines are designed for traditional online
transaction processing workloads, or OLTP, for brevity. Likewise, Amazon
Aurora is a MySQL and PostgreSQL-compatible relational database that was
built specifically for the cloud. As a matter of fact, it's one of the engines
offered by RDS, so it too supports transaction processing. Lastly, Amazon
DynamoDB, as mentioned earlier, is a fully managed NoSQL database
service that supports transaction processing. Therefore, from this list, the
only OLAP service is Amazon Redshift. Now let's switch over from warmup to
an actual practice exam question. The question reads, "A data management
team is tasked with handling a project that includes continuously updated
datasets in Amazon S3 and transactional data stored in a DynamoDB table.
To adhere to data retention policies and reduce storage expenses, the team
needs to establish a method that keeps only the necessary current data in
both storage systems. What strategy should the team implement to
efficiently manage the lifecycle of data in S3 and DynamoDB, ensuring
compliance with retention policies and cost effectiveness?" The options are
A, Enable S3 Object Lock in compliance mode on the S3 bucket to prevent
unintentional object deletions, and configure DynamoDB TTL to automatically
remove outdated data regularly. B, Set up a S3 Lifecycle policy to move older
objects to S3 Glacier and configure DynamoDB Streams to record changes in
the DynamoDB table, storing these changes in a dedicated archival S3
bucket. C, Enable versioning on the S3 bucket and configure S3 Lifecycle
policies to remove old object versions after a certain time for DynamoDB,
enable TTL to automatically delete items that have exceeded their useful
lifespan. D, Utilize S3 Intelligent-Tiering to automatically transfer infrequently
accessed objects to more cost-effective storage classes, and set up
DynamoDB Global Secondary Indexes (GSIs) to efficiently query data without
affecting the performance of the main table." Looking at these choices, one
way to go about this is to go straight to the choice that meets the
requirement of keeping only the necessary current data in both storage
systems, which is achieved in C by enabling versioning and lifecycle policies
in S3 and enabling TTL in DynamoDB. The other way to go about this
question is via elimination of choice. In A, the S3 Object Lock feature is
primarily used to prevent deletions for compliance and data protection
reasons, not for managing the lifecycle of non-essential data. In B, having a
S3 lifecycle policy to move objects to Glacier is a cost-effective way to
archive all their data, but it doesn't directly address deleting unnecessary
data. Lastly, in D, S3 Intelligent-Tiering helps with cost optimization for
infrequently accessed data, but it doesn't handle data deletion. And
DynamoDB global secondary indexes improve query performance, but don't
contribute to managing or deleting outdated data, hence why C is for sure
the correct answer for this question.
Now let's do a recap of the third domain of the data engineering certification,
data operations and support. The first question is, which service is primarily
used for interactive data analysis and can run SQL queries on data? Is it
Amazon EMR, AWS Glue, Amazon Athena or Amazon DataBrew? So for
interactive data analysis, Amazon EMR is not a suitable choice. While EMR
can run SQL queries through tools like Hive, Presto, and Spark SQL, it's
designed for processing vast amounts of data using big data frameworks
such as Apache Hadoop, Spark, and Flink. Basically, it's more suited for
complex data processing tasks and large-scale data analytics rather than
interactive querying. AWS Glue is an ETL service that's primarily used for
data preparation and transformation rather than direct interactive data
analysis using SQL. Amazon Athena is an ad hoc interactive query service
that allows you to analyze data on the fly by enabling you to run SQL queries
on data in S3 and other data sources. Lastly, Amazon DataBrew allows you to
visually clean and normalize your data without writing code. So it's an
excellent tool for cleaning, structuring, and enriching your data, but it's not
suitable for running interactive queries. Therefore, the correct answer is
Amazon Athena. Next question is, how can you create a persistent, central
data catalog for an EMR Apache Hive metadata store with the least
operational overhead? Generally speaking, there are two ways to create a
data catalog, internally with an EMR, this is the default option, or externally
outside of EMR. The key word here is least operational overhead. So we
should focus on external data catalogs, given that the default option involves
a ton of operational overhead. For external catalogs, you have two main
options. You can either go with an AWS Glue Data Catalog or an external Hive
metastore using either Amazon RDS or Aurora. AWS Glue is the simpler and
more effective solution, as it's easier to set up and configure. The RDS or
Aurora option involves setting up a relational database to serve as the Hive
metastore. So it requires more setup and maintenance compared to AWS
Glue. Next, let's take a look at this one. You need to scan S3 buckets across
your data pipeline to make sure they don't contain PII. Next, let's take a look
at this one. You need to scan S3 buckets across your data pipeline to make
sure they don't contain PII. How can this be achieved? Commonly provided
options usually include Macie, GuardDuty, WAF, and DataBrew. If the
question revolves around data discovery, data classification, automated
monitoring or data protection, especially in the context of PII and sensitive
data, then an answer that involves enabling Amazon Macie is your best bet.
Macie uses machine learning and pattern matching to automatically
discover, classify, and protect sensitive data like personally identifiable
information in your AWS environment. Be careful though because Macie can
be used as a distractor, even in questions where data discovery and
classification are mentioned. In these types of questions, the primary focus
will be other aspects of data security or management such as encrypting or
decrypting data, access management and managing permissions, intrusion
detection and prevention. For detecting and responding to attacks, the
correct answer might involve AWS GuardDuty or AWS WAF. Data backup and
disaster recovery questions might involve AWS Backup or other database
recovery features. Lastly, if the question revolves around logging and
monitoring, the correct answer might involve services such as AWS
CloudTrail, CloudWatch or AWS Config. Next, you're tasked to enable a group
of non-technical data analysts in validating and enriching incoming data. The
process should be easy to automate once it's defined. What service can help
accomplish this? So for this one, we're looking for a low or no-code solution
because our data analysts are non technical, and our requirements entail
validating and enriching the incoming data. Choices for this type of question
usually include Amazon Athena, AWS Glue, Amazon EMR, and AWS Glue
DataBrew. Now if the question is about enabling non-technical users, next
you're tasked with enabling a group of non-technical data analysts in
validating and enriching incoming data. The process should be easy to
automate once it's defined. What service can help accomplish this? Choices
for this type of question usually include Amazon Athena, AWS Glue, Amazon
EMR, and AWS Glue DataBrew. Given that the question here is about
enabling non-technical users to easily clean, normalize, and enrich the data,
then AWS Glue DataBrew is your best option. DataBrew provides a visual
interface that allows users to apply transformations, validation, and even
enrichments to their data without writing any code. From there, the data can
be invested into S3 and ultimately analyzed via Athena and QuickSight. And
if the question involves performing complex transformations using SQL and
Python where coding is allowed, then Athena Notebook would be a more
suitable choice. Here's the last one. Your company has several applications,
sending custom CloudWatch logs to several log groups. You need to
aggregate data, monitor application logs, and set up anomaly detection for
these logs as they arrive in real time. How can this be achieved? Here the
solution is going to involve Amazon OpenSearch. Other choices might include
Amazon CloudWatch, Amazon Kinesis, and AWS Lambda. If the question
involves near real-time aggregation, monitoring, and anomaly detection for
CloudWatch logs, then OpenSearch is likely to be the best fit. However, if the
question focuses on simply storing logs, performing basic monitoring or
simple logging without the need for real-time analytics or anomaly detection,
other services such as CloudWatch logs may be more appropriate in that
scenario.
If you've made it this far, you're so close to the finish line where we review
the last domain for the exam, and that is data security and governance. Let's
start with this scenario. You're trying to connect an EC2 instance to a private
RDS instance. The routing and IAM permissions are correct. What is the likely
issue? So commonly provided options usually include security groups,
network access control lists, IAM roles, and VPC peering. If the question
involves troubleshooting connection, whereby IAM permissions and routing
are configured properly, then the likely issue could be related to security
groups. Let's go over the troubleshooting steps for such a scenario. First, you
would need to verify that both the security groups and the network access
control lists, or NACL, for brevity are configured to allow database traffic
across your network. You do so by ensuring that the database security group
allows inbound traffic on the appropriate port from the security group
associated with the EC2 instance and that the security group of the EC2
instance allows outbound traffic to flow to the database security group. If all
is good, then the next troubleshooting step is to confirm that the NACLs for
these subnets containing the EC2 instance and the RDS instance are
configured to allow the necessary database traffic. Therefore, key words like
connectivity, issues with security groups or inbound and outbound traffic
rules could hint that security groups are to blame for connection failures. On
the other hand, if the question focuses on IAM roles, VPC peering or NACL
issues, then security groups might be a distractor in that case. Next, your
Redshift database contains PII that shouldn't be exposed to analysts, but
cannot be removed from the data. How can you give analysts access to the
database? So with such questions, most likely you'll be dealing with granting
SELECT and UPDATE privileges. You can grant SELECT and UPDATE privileges
explicitly on tables and columns. This allows fine-grained control over
specific data elements within the database. The second option is row-level
security policies, which, as the name conveys, allow you to restrict access to
specific rows based on predefined conditions such as user roles or
permissions. Another option is resorting to dynamic data masking. This
allows you to hide specific PII fields from analysts. So if this is our raw data,
you can use the DDM feature to perform a partial mask where you hide a
piece of the data or perform a full mask to mask the entire column. Dynamic
data masking applies transformation at the time of the querying, so it
doesn't affect the underlying data. Next, we've got this scenario where
you're required to encrypt data at rest in your organization's S3 bucket.
However, you're also required to have control over encryption keys and their
associated key policies. How can this be achieved? The encryption options
for S3 are S3 managed keys. These are managed entirely by AWS. So you
don't have control over the key policies, and therefore, they don't meet the
requirements. The second option is KMS keys. These can be managed by
AWS or by you as a customer. The third option is customer-provided keys.
The main difference between KMS keys and customer-provided keys is that
you would need to fully manage the customer-provided keys. So more
control, but also more operational overhead. Now, given that the question
doesn't specify a need for managing keys outside of AWS nor does it require
the highest level of operational control, you can stick to using KMS keys. This
option provides the necessary control over the encryption keys while
minimizing operational overhead compared to managing customer-provided
keys. Finally, data engineers that manage a Redshift cluster in another AWS
account need access to a materialized view from a Redshift cluster that you
manage. How can you share the materialized view without giving those data
engineers access to your Redshift cluster? To achieve this, your best bet is
Redshift's data-sharing feature. This feature will allow you to securely share
data without having to provide direct read-only access to your Redshift
cluster. This feature reflects changes in a live manner. So the shared cluster,
which is Redshift Cluster B in this diagram, will always be up to date. You can
also achieve this across different regions, accounts, and even between
different cluster types. And with this lesson coming to an end, we've come to
the end of our data engineer exam review course. This was Noreen Hasan. I
wish you the best of luck on your exam. And until next time, remember all
Gurus get there one lesson at a time.
Course 2