<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.2">Jekyll</generator><link href="https://blog.shikisoft.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.shikisoft.com/" rel="alternate" type="text/html" /><updated>2026-04-07T09:29:30+00:00</updated><id>https://blog.shikisoft.com/feed.xml</id><title type="html">Shikisoft Blog</title><subtitle>Shikisoft is a cloud solutions provider specialized in Amazon Web Services - AWS with an AWS Certified team. We offer remote consulting services mainly on serverless and devops methodologies according to AWS best practices. We are located in Istanbul, Turkey.
</subtitle><entry><title type="html">Amazon S3 Storage Classes &amp;amp; Lifecycle Management: Optimizing Your Cloud Object Storage</title><link href="https://blog.shikisoft.com/amazon-s3-storage-classes-lifecycle-management/" rel="alternate" type="text/html" title="Amazon S3 Storage Classes &amp; Lifecycle Management: Optimizing Your Cloud Object Storage" /><published>2025-04-30T00:00:00+00:00</published><updated>2025-04-30T00:00:00+00:00</updated><id>https://blog.shikisoft.com/amazon-s3-storage-classes-lifecycle-management</id><content type="html" xml:base="https://blog.shikisoft.com/amazon-s3-storage-classes-lifecycle-management/">&lt;p&gt;As a popular object storage service, Amazon S3 allows you to store data in buckets. However, in most cases, some data becomes irrelevant and less frequently accessed over time. If you leave things as they are, the data will continue to take up space, leading to extra storage costs, not to mention performance inefficiencies.&lt;/p&gt;

&lt;p&gt;The good news is that Amazon S3 provides various storage classes for different access patterns that align with your storage performance and cost requirements. Besides, by configuring S3 lifecycle policies, you can transition objects to other storage classes or permanently delete them after a specific period.&lt;/p&gt;

&lt;p&gt;This post will guide you through AWS S3 storage classes and introduce lifecycle policies to help you develop a cost-optimized and effective data management process.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;s3-standard--express-one-zone-for-frequently-accessed-objects&quot;&gt;S3 Standard &amp;amp; Express One Zone for Frequently Accessed Objects&lt;/h2&gt;

&lt;p&gt;AWS offers the S3 Standard storage class for frequently accessed objects and the S3 Express One Zone for the most frequently accessed objects requiring high-performance storage. As its name implies, the S3 Express One Zone stores objects in only one AWS Availability Zone, making it a lower-cost option than the S3 Standard.&lt;/p&gt;

&lt;p&gt;However, in case of any problem with that AZ, your data may be lost or damaged, since there is no data replication across multiple AZs. Meanwhile, with the S3 Standard storage class, the objects are stored across several Availability Zones. So, the S3 Standard storage class offers more resiliency than S3 Express One Zone. Therefore, we advise you to choose S3 Express One Zone only for your reproducible infrequently accessed data, so as not to take any risk.&lt;/p&gt;

&lt;h2 id=&quot;what-are-your-options-for-infrequently-accessed-objects&quot;&gt;What are Your Options for Infrequently Accessed Objects?&lt;/h2&gt;

&lt;p&gt;Objects you don’t need frequently but still require millisecond access can be transferred to the S3 Standard-IA (Infrequent Access) or S3 One-Zone IA storage class. These classes offer the same durability and low latency as the S3 Standard and S3 Express One Zone storage classes, respectively.&lt;/p&gt;

&lt;p&gt;S3 Standard-IA and S3 One-Zone IA both offer lower cost than their frequently accessed storage classes. However, there is an extra retrieval fee when the object is accessed. So, you should only use them if the object is infrequently accessed, a few times a month.&lt;/p&gt;

&lt;p&gt;There is a minimum duration for S3 Standard-IA and S3 One Zone-IA storage classes, which is 30 days. If you delete the object or move it to another class within this period, you still pay the 30-day full price in that class in addition to the costs of any class for the remaining days.&lt;/p&gt;

&lt;p&gt;Besides, the minimum object size is 128 KB in S3 Standard-IA and S3 One Zone-IA. So, if the object is smaller than 128 KB, you still pay the 128 KB cost. Hence, these classes may not be feasible for small objects.&lt;/p&gt;

&lt;h2 id=&quot;s3-glacier-storage-classes-freeze-your-rarely-used-objects-in-the-glacier&quot;&gt;S3 Glacier Storage Classes: ‘Freeze’ Your Rarely Used Objects in the Glacier&lt;/h2&gt;

&lt;p&gt;Until now, we have discussed storage options for frequently or infrequently accessed objects. But what about the rarely accessed data you must keep for archival purposes, regulatory requirements, etc.? Amazon S3 Glacier storage classes are built for this purpose. You can choose among three archival storage classes offering different retrieval times and storage costs: S3 Glacier Instant Retrieval, S3 Glacier Flexible Retrieval, and S3 Glacier Deep Archive. Let’s analyze each S3 Glacier storage class.&lt;/p&gt;

&lt;h3 id=&quot;s3-glacier-instant-retrieval&quot;&gt;S3 Glacier Instant Retrieval&lt;/h3&gt;

&lt;p&gt;Suppose you have rarely accessed data but still need immediate access. The S3 Glacier Instant Retrieval storage class offers millisecond retrieval time, the same as S3 Standard or S3 Standard-IA, with much lower storage costs. It can be suitable for cases like image hosting, storing health records that aren’t used generally but need immediate access during a doctor’s appointment, or archived photos or videos that sometimes require instant access.&lt;/p&gt;

&lt;p&gt;So, if you have data you access only once per quarter, the S3 Glacier Instant Retrieval storage class can save you a lot on storage costs. S3 Glacier Instant Retrieval has a minimum storage duration of 90 days.&lt;/p&gt;

&lt;h3 id=&quot;s3-glacier-flexible-retrieval&quot;&gt;S3 Glacier Flexible Retrieval&lt;/h3&gt;

&lt;p&gt;This storage class is ideal for archiving data you access semi-annually. As its name implies, the S3 Glacier Flexible Retrieval storage class offers flexible retrieval times from minutes to hours, unlike the S3 Glacier Instant Retrieval. However, it has the same minimum storage duration as S3 Glacier Instant Retrieval, which is 90 days.&lt;/p&gt;

&lt;p&gt;When you restore the object, you can choose from three retrieval tiers.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The expedited retrieval option generally restores an object within 1 to 5 minutes.&lt;/li&gt;
  &lt;li&gt;Meanwhile, the standard retrieval takes 3 to 5 hours.&lt;/li&gt;
  &lt;li&gt;The third option is bulk retrieval, which is free, but you must wait for 5 to 12 hours to access your objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, choosing the one that fits your specific use case is your call.&lt;/p&gt;

&lt;p&gt;S3 Glacier Flexible Retrieval is usually recommended for backup or disaster recovery because it allows you to archive large sets of data and retrieve them at a lower cost. However, once the objects are archived, you cannot access them in real time. You must submit a restore request to access stored objects and wait until it completes.&lt;/p&gt;

&lt;h3 id=&quot;s3-glacier-deep-archive&quot;&gt;S3 Glacier Deep Archive&lt;/h3&gt;

&lt;p&gt;Finally, let’s discuss the most cost-effective storage class, and my favorite: S3 Glacier Deep Archive. As the name suggests, this storage option is designed to store rarely accessed data deep down the ‘glacier’. It is especially recommended for meeting regulatory requirements or long-term archiving, as it allows storing large amounts of data for many years.&lt;/p&gt;

&lt;p&gt;Like S3 Glacier Instant Retrieval, real-time access is unavailable for the S3 Glacier Deep Archive. So, you must create a restore request to access your objects. After that, you can choose one of the two retrieval tiers for your use case.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The standard retrieval option generally retrieves your objects within 12 hours.&lt;/li&gt;
  &lt;li&gt;Whereas bulk retrieval can take up to 48 hours.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, the S3 Glacier Deep Archive differs from other S3 Glacier storage classes with its minimum storage duration of 180 days.&lt;/p&gt;

&lt;p&gt;As you will read in my use case below, you can also use Amazon S3 Glacier Deep Archive for backups and disaster recovery if your business recovery time objective (RTO) allows you to wait up to 72 hours to restore from your backups.&lt;/p&gt;

&lt;h2 id=&quot;s3-intelligent-tiering-what-if-you-dont-know-how-often-your-objects-are-accessed&quot;&gt;S3 Intelligent Tiering: What if you don’t know how often your objects are accessed?&lt;/h2&gt;

&lt;p&gt;You may have objects whose access patterns you can’t predict. In this case, you can choose the S3 Intelligent-Tiering storage class for automatic cost savings. Once you use this class, AWS will automatically monitor your objects’ access patterns and transfer them to the most effective access tier for you. The objects will be moved between three access tiers based on the access frequency: Frequent Access, Infrequent Access, and Archive Instant Access.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;When first transitioning to the S3 Intelligent Tiering storage class, the objects are stored in the Frequent Access tier by default.&lt;/li&gt;
  &lt;li&gt;Then, if an object has no access for 30 consecutive days, it will be moved to the Infrequent Access tier.&lt;/li&gt;
  &lt;li&gt;Lastly, the objects not accessed for 90 days will be moved to the Archive Instant Access tier. These tiers offer the same low latency level as the S3 Standard while helping you save on storage costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon S3 also offers two optional archiving tiers, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Archive Access&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Deep Archive Access&lt;/code&gt;, which you can activate under the S3 Intelligent Tiering storage class. They correspond to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S3 Glacier Flexible Retrieval&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S3 Glacier Deep Archive&lt;/code&gt; storage classes, respectively.&lt;/p&gt;

&lt;h2 id=&quot;automating-s3-storage-management-with-lifecycle-policies&quot;&gt;Automating S3 Storage Management with Lifecycle Policies&lt;/h2&gt;

&lt;p&gt;If your object’s access pattern changes over time, you can automatically move it to lower-cost classes and eventually delete it when it is no longer relevant to keep. By configuring S3 lifecycle policies, you can transition objects to different storage classes or permanently delete them after a specific period.&lt;/p&gt;

&lt;p&gt;An S3 lifecycle policy consists of rules that will apply to your objects throughout their lifetime. You can set up a transition action to automatically move an object to a different storage class after a specified period. Also, you can define a delete action to delete an object permanently.&lt;/p&gt;

&lt;p&gt;Its primary difference from S3 Intelligent Tiering is that it doesn’t take objects’ access patterns into account, and you can customize the duration between the transition actions as long as it aligns with the minimum storage duration. For example,&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You can move an object automatically to Standard-IA 45 days after creation. You can’t move an object ot Standard-IA or One Zone-IA before 30 days in S3 Standard.&lt;/li&gt;
  &lt;li&gt;However, Standard-IA has a 30-day minimum storage duration. Hence, you can define another rule to move it to S3 Glacier storage classes after an additional 30 days (total: 75 days).&lt;/li&gt;
  &lt;li&gt;If you don’t have to keep the object, you can just delete it without moving to S3 Glacier storage classes. You can align the rule according to your use case.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;my-use-case--backup-storage-for-final-cut-pro-x-libraries&quot;&gt;My Use Case:  Backup Storage for Final Cut Pro X Libraries&lt;/h3&gt;

&lt;p&gt;Let me give you another example. As you may already know, I have &lt;a href=&quot;https://courses.shikisoft.com&quot;&gt;online courses on Udemy&lt;/a&gt;. While producing these courses, I use Final Cut Pro X to edit my videos. So, I occasionally take backups of my Final Cut libraries and upload them to S3.&lt;/p&gt;

&lt;p&gt;These backup files are large and take up GBs of storage space. I only access these files if there is a problem on my local disk drives for disaster recovery. Keeping them in the S3 Standard class would cost me a lot, considering the new versions I continue to upload. So, I needed a cost-effective solution for my backup storage.&lt;/p&gt;

&lt;p&gt;As a solution, I defined an S3 lifecycle rule to move the object to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;S3 Glacier Deep Archive&lt;/code&gt; storage class on day 0, as I don’t need to access it unless there is a disaster in my office. In that unlikely scenario, I can wait up to 72 hours to restore the backup library.&lt;/p&gt;

&lt;p&gt;Besides, to keep the storage costs down even more, another rule automatically deletes any previous versions from the S3 Glacier Deep Archive after 6 months. It is because if I didn’t need a previous version in 6 months, I almost certainly won’t need it later. However, I always keep the latest version in the S3 Glacier Deep Archive. &lt;strong&gt;This way, I decreased my backup storage costs on S3 by 10 times.&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Amazon S3 provides different storage classes to manage your data storage efficiently and cost-effectively. S3 Lifecycle Management is also an automated way to move your objects between different storage classes or permanently expire them. In this post, we analyzed the main features of each S3 storage class to help you learn how to use S3 lifecycle policies for your unique cases. I hope you can benefit from it.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and see you in our other posts.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html#sc-infreq-data-access&quot;&gt;Understanding and managing Amazon S3 storage classes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html&quot;&gt;Managing the lifecycle of objects&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-04-s3/s3-storage-classes.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2025-04-s3/s3-storage-classes.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2025-04-s3/s3-storage-classes.jpg&quot; alt=&quot;Amazon S3 Storage Classes &amp;amp; Lifecycle Management: Optimizing Your Cloud Object Storage&quot; width=&quot;1600&quot; height=&quot;900&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="Amazon S3" /><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2025-04-s3/s3-storage-classes.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2025-04-s3/s3-storage-classes.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Which Amazon EC2 Instance Type is Right for You?</title><link href="https://blog.shikisoft.com/which-ec2-instance-type/" rel="alternate" type="text/html" title="Which Amazon EC2 Instance Type is Right for You?" /><published>2025-03-25T00:00:00+00:00</published><updated>2025-03-25T00:00:00+00:00</updated><id>https://blog.shikisoft.com/which-ec2-instance-type</id><content type="html" xml:base="https://blog.shikisoft.com/which-ec2-instance-type/">&lt;p&gt;Amazon EC2 instances allow you to create your own virtual servers on the cloud, freeing you from the burden of maintaining your own physical architecture. EC2 provides various instance type choices to host your applications. However, having more choices may sometimes confuse you, and you may feel overwhelmed when choosing the optimal one. So, let me help you by simplifying EC2 instance types in this post.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;what-is-an-ec2-instance-type&quot;&gt;What is an EC2 instance type?&lt;/h2&gt;

&lt;p&gt;When creating an EC2 instance, you choose an instance type that determines the hardware characteristics of the physical host server on which it will be placed. The instance type also specifies its size and how much you will pay per minute when it is running.&lt;/p&gt;

&lt;p&gt;You may see weird characters in instance types, but each has a purpose. The instance type naming follows a specific pattern. First comes the instance family part, which is followed by the instance size after a dot.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-type-format.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-type-format.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-type-format.jpg&quot; alt=&quot;EC2 instance type format - Shikisoft Blog&quot; width=&quot;1440&quot; height=&quot;810&quot; /&gt;
    
&lt;/picture&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The instance family begins with the series. The series is the most critical part of the instance type because it specifies the main characteristics.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The series is followed by the generation number of the series. Over time, AWS upgrades physical host servers and releases new generations.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Next comes the options part of the generation, which includes a few optional letters or words. These options may represent the CPU architecture of the instance family, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Graviton&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Intel&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AMD&lt;/code&gt;. An instance type may also include other options, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Network and EBS optimized&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; for those providing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;instance-store storage&lt;/code&gt;. These are the current options:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;a – AMD processors&lt;/li&gt;
      &lt;li&gt;g – AWS Graviton processors&lt;/li&gt;
      &lt;li&gt;i – Intel processors&lt;/li&gt;
      &lt;li&gt;b – Block storage optimization&lt;/li&gt;
      &lt;li&gt;d – Instance store volumes&lt;/li&gt;
      &lt;li&gt;e – Extra storage or memory&lt;/li&gt;
      &lt;li&gt;flex – Flex instance&lt;/li&gt;
      &lt;li&gt;n – Network and EBS optimized&lt;/li&gt;
      &lt;li&gt;q – Qualcomm inference accelerators&lt;/li&gt;
      &lt;li&gt;z – High CPU frequency&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-family.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-family.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-family.jpg&quot; alt=&quot;EC2 instance family format - Shikisoft Blog&quot; width=&quot;1440&quot; height=&quot;810&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;The size part after the dot (.) is simple: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nano&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;micro&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;small&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;medium&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;large&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xlarge&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2xlarge&lt;/code&gt;, etc. It goes on as powers of 2. It determines how much resources will be allocated to the instance. Therefore, together with the instance family, the size finalizes the instance’s cost per minute.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-size.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-size.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-size.jpg&quot; alt=&quot;EC2 instance size format - Shikisoft Blog&quot; width=&quot;1440&quot; height=&quot;810&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Amazon EC2 provides various instance types with distinct advantages and use cases. The instance families are also grouped into categories. Now, let’s discuss them one by one. I also added some keywords in parenthesis to help you remember the purpose of each instance series.&lt;/p&gt;

&lt;h2 id=&quot;general-purpose-instance-types&quot;&gt;General Purpose Instance Types&lt;/h2&gt;

&lt;p&gt;This category offers instance types with balanced memory, compute, and networking resources. They are feasible if your application uses these resources equally, such as web servers.&lt;/p&gt;

&lt;h3 id=&quot;m-instances-medium&quot;&gt;M Instances (Medium)&lt;/h3&gt;

&lt;p&gt;The M series instances are in this category, which provides consistent performance and is ideal and cost-effective if you know the expected load on your application most of the time.&lt;/p&gt;

&lt;h3 id=&quot;t-instances-threshold&quot;&gt;T Instances (Threshold)&lt;/h3&gt;

&lt;p&gt;The other option is the T-series, which are burstable instances. These instances normally operate at a baseline performance (threshold), such as 20%, and accumulate CPU credits when the load is below the baseline. They use these credits to burst to 100% CPU capacity if the load becomes high later. Hence, they are cost-effective when you don’t know your apps’ load characteristics yet or if your app’s load is mostly low. But don’t expect consistent CPU performance as in M instances because they always operate at 100% CPU capacity.&lt;/p&gt;

&lt;p&gt;Currently, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t4g.micro&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t3.micro&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t2.micro&lt;/code&gt; instances provide &lt;strong&gt;AWS free-tier benefits with 750 hours/month cumulatively&lt;/strong&gt;. So, I mostly use these instance types during hands-on examples in &lt;a href=&quot;https://courses.shikisoft.com&quot;&gt;my courses&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;mac-instances-mac&quot;&gt;Mac Instances (Mac)&lt;/h3&gt;

&lt;p&gt;Mac instances are also in this category. They provide on-demand macOS instances on the cloud. So, if you are developing apps for the Apple ecosystem, such as iPhone, Mac, or Apple TV, you can use these instances to develop, build, and test your apps.&lt;/p&gt;

&lt;h2 id=&quot;compute-optimized-instance-types&quot;&gt;Compute-optimized Instance Types&lt;/h2&gt;

&lt;p&gt;The second category is the compute-optimized instances. They offer high-performance processors for compute-intensive applications. The C-series instances belong to this category.&lt;/p&gt;

&lt;h3 id=&quot;c-instances-compute-or-cpu&quot;&gt;C Instances (Compute or CPU)&lt;/h3&gt;

&lt;p&gt;The instances in this series have more virtual CPU cores per GB of memory. They can be used for media transcoding, high-performance web servers, high-performance computing (HPC), scientific computing, batch processing, machine learning inference, and anything else that requires high-performance CPUs.&lt;/p&gt;

&lt;h2 id=&quot;memory-optimized-instance-types&quot;&gt;Memory-optimized Instance Types&lt;/h2&gt;

&lt;p&gt;Next, you have memory-optimized instance types. The instance types in this category provide fast performance for memory-intensive applications that process large data sets in memory.&lt;/p&gt;

&lt;p&gt;There are multiple instance series in this category.&lt;/p&gt;

&lt;h3 id=&quot;r-instances-ram&quot;&gt;R Instances (RAM)&lt;/h3&gt;

&lt;p&gt;The R-series instances are designed for standard memory-intensive applications, such as open-source relational databases like MySQL, in-memory caches like Redis, or real-time big data analytics.&lt;/p&gt;

&lt;h3 id=&quot;x-instances-extra-ram&quot;&gt;X Instances (Extra RAM)&lt;/h3&gt;

&lt;p&gt;The X-series provides more memory capacity than its R-series counterparts in the same sizes with similar use cases that require more memory.&lt;/p&gt;

&lt;h3 id=&quot;u-instances-ultra-large&quot;&gt;U Instances (Ultra Large)&lt;/h3&gt;

&lt;p&gt;U-series instances are designed for large enterprise databases, such as SAP HANA. They are huge and have very high memory and processor capacity.&lt;/p&gt;

&lt;h3 id=&quot;z-instances-z---a-sign-for-high-frequency&quot;&gt;Z Instances (Z - A sign for High-frequency)&lt;/h3&gt;

&lt;p&gt;The Z-series is new and offers both high-frequency compute and high memory capacity. It also provides large instance store capacity to increase performance.&lt;/p&gt;

&lt;h2 id=&quot;accelerated-computing-instance-types&quot;&gt;Accelerated Computing Instance Types&lt;/h2&gt;

&lt;p&gt;In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;accelerated computing&lt;/code&gt;, you offload some tasks to specialized &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hardware accelerators&lt;/code&gt;, often GPUs and other co-processors, to speed up processing with parallelization. For example, suppose your app performs graphics processing, data pattern matching, or scientific floating point number calculation. In that case, using a hardware accelerator is more efficient than relying on a standard CPU. &lt;strong&gt;So, the instances in this family offer hardware accelerators or co-processors in addition to virtual CPUs.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They are ideal for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deep learning&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;generative AI&lt;/code&gt; applications like&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;code generation,&lt;/li&gt;
  &lt;li&gt;speech recognition,&lt;/li&gt;
  &lt;li&gt;video and image generation,&lt;/li&gt;
  &lt;li&gt;high-performance computing (HPC) applications such as
    &lt;ul&gt;
      &lt;li&gt;computational fluid dynamics,&lt;/li&gt;
      &lt;li&gt;weather forecasting,&lt;/li&gt;
      &lt;li&gt;computational finance,&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;graphics processing like
    &lt;ul&gt;
      &lt;li&gt;real-time rendering,&lt;/li&gt;
      &lt;li&gt;cinematic-quality graphics,&lt;/li&gt;
      &lt;li&gt;game streaming, etc.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yes, all these require specialized hardware.&lt;/p&gt;

&lt;h3 id=&quot;g-instances-gpu&quot;&gt;G Instances (GPU)&lt;/h3&gt;

&lt;p&gt;The first members of this category are G-series instances. They are GPU-based instances with Nvidia GPUs for standard machine learning and high-performance needs.&lt;/p&gt;

&lt;h3 id=&quot;p-instances-power&quot;&gt;P Instances (Power)&lt;/h3&gt;

&lt;p&gt;The P-series instances also have Nvidia GPUs. They provide more GPUs and GPU memory than G-based instances, so they are for applications that demand more GPU capacity.&lt;/p&gt;

&lt;h3 id=&quot;trn-instances-trainium&quot;&gt;Trn Instances (Trainium)&lt;/h3&gt;

&lt;p&gt;The Trn-series instances contain AWS’s Trainium chips as hardware accelerators, which are designed for high-performance machine learning training and inference workloads.&lt;/p&gt;

&lt;h3 id=&quot;inf-instances-inferentia&quot;&gt;Inf Instances (Inferentia)&lt;/h3&gt;

&lt;p&gt;Another instance series with purpose-built chips is the Inf series. These instances contain AWS’s Inferentia chips specially designed for deploying deep learning and generative AI inference workloads.&lt;/p&gt;

&lt;h3 id=&quot;dl-instances-deep-learning&quot;&gt;DL Instances (Deep Learning)&lt;/h3&gt;

&lt;p&gt;The DL series is dedicated to deep learning and contains Gaudi accelerators from Habana Labs or Qualcomm AI 100 accelerators.&lt;/p&gt;

&lt;h3 id=&quot;f-instances-fpgas&quot;&gt;F Instances (FPGAs)&lt;/h3&gt;

&lt;p&gt;The F-series instances have field-programmable gate arrays (FPGAs), which are suitable for genetics research, financial analytics, real-time video processing, etc.&lt;/p&gt;

&lt;h3 id=&quot;vt-instances-video-transcoding&quot;&gt;VT Instances (Video Transcoding)&lt;/h3&gt;

&lt;p&gt;The VT series instances are designed for video transcoding needs such as broadcasting live events and video conferencing.&lt;/p&gt;

&lt;h2 id=&quot;storage-optimized-instance-types&quot;&gt;Storage-optimized Instance Types&lt;/h2&gt;

&lt;p&gt;The next category is storage-optimized instances. These are feasible if your workloads perform high, sequential read/write operations to large data sets in local storage or perform tens of thousands of low-latency, random input-output operations per second (IOPS).&lt;/p&gt;

&lt;p&gt;These two access patterns require different types of storage: solid-state drives (SSDs) and hard disk drives (HDDs).&lt;/p&gt;

&lt;h3 id=&quot;i-instances-iops&quot;&gt;I Instances (IOPS)&lt;/h3&gt;

&lt;p&gt;The I-series instances have solid-state drive (SSD) disks with high input-output (IO) performance because they are designed for workloads that require real-time, random, and low-latency access.&lt;/p&gt;

&lt;p&gt;These applications frequently access random parts of storage, but they return relatively smaller data chunks than others. They are ideal for workloads such as relational and No-SQL databases, real-time databases, and real-time analytics engines.&lt;/p&gt;

&lt;h3 id=&quot;d-instances-dense&quot;&gt;D Instances (Dense)&lt;/h3&gt;

&lt;p&gt;On the other hand, the D series instances offer high performance for sequential, not random, input-output operations and high disk throughput. They have hard disk drives (HDDs) instead of SSDs, providing better performance and lower costs for those needs.&lt;/p&gt;

&lt;p&gt;You can use them for distributed file systems such as MapReduce File Systems, massively parallel data warehouses such as Redshift, big data analytics workloads such as Spark or Hadoop, or data processing apps such as Kafka or Elasticsearch.&lt;/p&gt;

&lt;h3 id=&quot;h-instances-hard-disk---hdd&quot;&gt;H Instances (Hard Disk - HDD)&lt;/h3&gt;

&lt;p&gt;Alternatively, you can opt for H-series instances if you need instances with HDD disks that balance CPU and memory. They have less memory per CPU than D-series instances but are cheaper.&lt;/p&gt;

&lt;h2 id=&quot;hpc-instance-types-hpc&quot;&gt;HPC Instance Types (HPC)&lt;/h2&gt;

&lt;p&gt;Lastly, there is the HPC-optimized category. These instances are designed to provide the best price-performance ratio for high-performance computing needs. This category has only a single instance series with the same name.&lt;/p&gt;

&lt;h3 id=&quot;hpc-instances&quot;&gt;HPC Instances&lt;/h3&gt;

&lt;p&gt;The HPC-series instances are in this category. They don’t have hardware accelerators or co-processors; they only have high-performance CPUs. They are cost-effective and feasible for HPC applications with moderate needs, such as weather forecasting or molecular dynamics.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Amazon EC2 provides various instance types for different use cases and budgets. For example, you can use compute-optimized, accelerated computing, or HPC instances for high-performance computing. Each provides a different price per performance. So, it all depends on your application’s type and how much you are willing to spend. Solutions architecting is about choosing the optimal solution that aligns with your budget and needs. I hope this post will be helpful as a summary of EC2 instance types.&lt;/p&gt;

&lt;p&gt;By the way, the contents of this blog and the screenshots are from my incoming course on AWS Certified Cloud Practitioner certification. It will help you learn AWS basics while earning a crucial certificate. Follow me on &lt;a href=&quot;&quot;&gt;LinkedIn&lt;/a&gt; and &lt;a href=&quot;&quot;&gt;X.com (formerly Twitter)&lt;/a&gt; to know when it is ready.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and see you in our next post!&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://aws.amazon.com/ec2/instance-types/&quot;&gt;Amazon EC2 Instance types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-03-instance-types/ec2-instance-types-hero.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/fallback folder&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/fallback folder&quot; alt=&quot;Which Amazon EC2 Instance Type is Right for You? - Shikisoft Blog&quot; width=&quot;1440&quot; height=&quot;810&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="Amazon EC2" /><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2025-03-instance-types/ec2-instance-types-hero.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2025-03-instance-types/ec2-instance-types-hero.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">AWS Certified Solutions Architect – Professional: Renewing My Certification Again in 2024</title><link href="https://blog.shikisoft.com/aws-certified-solutions-architect-professional-2024-experience/" rel="alternate" type="text/html" title="AWS Certified Solutions Architect – Professional: Renewing My Certification Again in 2024" /><published>2025-02-28T00:00:00+00:00</published><updated>2025-02-28T00:00:00+00:00</updated><id>https://blog.shikisoft.com/aws-certified-solutions-architect-professional-2024-experience</id><content type="html" xml:base="https://blog.shikisoft.com/aws-certified-solutions-architect-professional-2024-experience/">&lt;p&gt;Three months ago, on the last day of November last year, I took and passed the famous &lt;strong&gt;AWS Certified Solutions Architect – Professional&lt;/strong&gt; exam for the third time. Due to recent health problems, I couldn’t study as much as I had hoped. Still, I passed with a decent score of 837/1000 and extended it to 2027. I also renewed my first AWS certificate, &lt;strong&gt;AWS Certified Solutions Architect – Associate&lt;/strong&gt; with this exam and guaranteed to be &lt;strong&gt;AWS certified for over 10 years&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The exam was different each time I took it. Thus, as of the end of 2024, I want to share my experiences for the third time. I hope it also helps you in your AWS certification journeys. 
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;how-did-i-prepare-for-the-aws-certified-solutions-architect--professional-exam&quot;&gt;How did I prepare for the AWS Certified Solutions Architect – Professional exam?&lt;/h2&gt;

&lt;p&gt;My exam preparations primarily consist of these steps:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Viewing the exam blueprint.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Reading AWS whitepapers if necessary.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Reading each service’s FAQ and, optionally, the primary documentation if it is essential.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Viewing recent re:Invent sessions about services from YouTube when needed.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Taking notes and trying the services included hands-on.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I haven’t taken online certification courses because I am also planning to build one and didn’t want to learn from other instructors and develop my knowledge. Of course, this was the hard way. However, this way, my future courses will be genuine and help you from another perspective.&lt;/p&gt;

&lt;p&gt;I already &lt;a href=&quot;/passed-aws-certified-devops-engineer-professional-2024/&quot;&gt;renewed my AWS Certified DevOps Engineer – Professional certification&lt;/a&gt; two months before taking the AWS Certified Solutions Architect – Professional exam. Hence, I didn’t have to study DevOps topics for this exam. I just reviewed some of my notes to recall their use cases as a solutions architect.&lt;/p&gt;

&lt;p&gt;Reading the documentation and trying the service help greatly. You understand the service well. Watching AWS re:Invent videos is also very valuable because you need to understand AWS services from a solutions architect’s perspective.&lt;/p&gt;

&lt;h2 id=&quot;about-the-aws-certified-solutions-architect--professional-exam-content&quot;&gt;About the AWS Certified Solutions Architect – Professional exam content&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;AWS Certified Solutions Architect – Professional&lt;/strong&gt; exam is the same as the AWS Certified DevOps Engineer exam in style but is very different in terms of content. It is not as detailed as the DevOps exam. However, its questions are &lt;strong&gt;more scenario-based&lt;/strong&gt;, mostly with answers asking to select 2-3 choices together, and you must decide what is best for the situation asked as an AWS solutions architect. Mostly, you don’t have to know the exact configuration for a service’s resources in detail. It is more like you must know where to use the service.&lt;/p&gt;

&lt;p&gt;As far as I remember, here are the key topics asked in the exam. I divided them into categories to make them easier to identify. However, most questions actually fall into multiple categories.&lt;/p&gt;

&lt;h3 id=&quot;organizations&quot;&gt;Organizations&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;As in all AWS Certified Solutions Architect – Professional exams, AWS Organizations take a central place. However, it is asked more with other domains because it is an organizational structure.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;You must know Organizations in general and how to share resources between accounts with the AWS Resource Access Manager.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Applying tag policies across your organization also appeared.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Trusted advisor and GuardDuty usage in a multi-account organizational setting is also crucial.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know AWS Control Tower in general. Although it was not asked for in detail, like in the DevOps exam, it is still crucial.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;migration&quot;&gt;Migration&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Migrating an on-premises server and data with minimal effort with AWS Systems Manager, AWS Backup, and VM Import/Export&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Connecting to an on-premises database to collect database and table information to perform migration analysis. You should know the AWS Database Migration Service and Schema Conversion Tool (SCM) features.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Performing a migration analysis with or without installing anything on the servers: AWS Migration Evaluator, AWS Application Migration Service agent-based and agentless discoveries. Reading the migration whitepaper may be helpful.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Transferring data to AWS with AWS DataSync, AWS Transfer Family, or AWS Storage Gateway.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Migration of OLAP DBs and Oracle DBs to Redshift.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Knowing to use AWS Outposts in migrations to AWS.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;security--compliance&quot;&gt;Security &amp;amp; Compliance&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Knowing how to use IAM permission boundaries and Security Control Policies (SCPs) to limit the permissions of an IAM identity is crucial. You should also know their differences.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;AWS Config: How to be notified with SNS when a user changes something in an AWS account without preventing her from doing it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Differences between AWS CloudHSM, Amazon KMS, and Amazon S3 encryption&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using Security Hub as a central place for security in your AWS organization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using AWS Web Application Firewall (WAF) with ALBs and API Gateway APIs&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Scanning Amazon ECR images with Amazon Inspector automatically&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know how Identity Center SAML authentication works and how it is configured.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Learn what Audit Manager is used for. It appeared in a few questions.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;serverless&quot;&gt;Serverless&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;API Gateway was an essential topic in the exam. You should know AWS solutions for:
    &lt;ul&gt;
      &lt;li&gt;APIs accessed from multiple regions&lt;/li&gt;
      &lt;li&gt;Private APIs accessed only from VPCs&lt;/li&gt;
      &lt;li&gt;APIs triggering AWS Lambda functions&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Hosting static sites on Amazon S3 with Amazon CloudFront&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using Amazon RDS access points in Lambda functions ( It may also be considered in the DB category. )&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Step Functions were not asked as detailed as in the DevOps Engineer exam. However, they appeared in answers to a few questions. Learn how to orchestrate API calls and Lambda function executions with Step Functions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Networking with AWS Transit Gateway and VPN Gateway and connecting to multiple VPCs using a dedicated DirectConnect connection.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using AWS Firewall Manager to automatically add AWS WAF rules across accounts and new accounts. Using AWS Systems Manager Parameter Store to store parameters.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Routing policies on Amazon Route 53 had a few questions. You may be asked why a specific failover configuration doesn’t work or design a failover solution for a multi-region architecture.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;databases&quot;&gt;Databases&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Solutions for creating leaderboards: The differences between Amazon MemoryDB and Amazon ElastiCache for single-digit latency with the ability to preserve data for later analysis. You may also be asked to do it with Amazon DynamoDB.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Caching Amazon DynamoDB tables with DAX, using DynamoDB Global Tables in multi-region architectures, and DynamoDB auto-scaling were asked.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Some questions involved Aurora and Aurora Global Databases. Amazon RDS was also asked, but less than Aurora. Know how to use Aurora readers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Knowing Amazon Redshift, in general, also helps. Amazon Neptune was among the options in some questions but not directly mentioned.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using in-memory DBs for high-performance computing.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Amazon DocumentDB appeared in a question. Amazon Timestream was among the options in some questions.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;storage&quot;&gt;Storage&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;You should know Amazon S3 access points and their use cases.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Amazon EFS and Amazon EBS differences. Configuring multi-access to EFS filesystems from other EC2 instances.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Knowing the platforms in Amazon FSx family services would help. For example, which one supports NFS and SMB? The questions were primarily about Windows File Server, but Lustre also appeared.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;devops-tools&quot;&gt;DevOps Tools&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Architecting a CI/CD pipeline using AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy services with minimal effort.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using the Service Catalog to launch verified AWS CloudFormation templates without affecting the current user’s abilities.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Container solutions with AWS AppRunner, Amazon ECS, Amazon EKS, and AWS Fargate. Know what they are used for. It was not as detailed as the DevOps exam.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Elastic Beanstalk appeared only once as an answer to launching EC2 instances behind an ALB and performing Blue/Green deployments with minimal effort. The DB was separated naturally.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know Amazon X-Ray and tracing in general. There were a few questions about Amazon CloudWatch logs and metrics, but it was not emphasized as in the DevOps exam.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;data-analytics&quot;&gt;Data Analytics&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Using Kinesis Data Firehose and Data Streams to stream CloudTrail and CloudWatch logs to S3 and other target locations.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know the use cases of AWS Glue, Athena, and QuickSight.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Learn Amazon EMR in general. It appeared in some questions and answers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know Amazon OpenSearch in general.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;application-integration--messaging&quot;&gt;Application Integration &amp;amp; Messaging&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Know how to use Amazon EventBridge to route events from an API to multiple consumers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know the differences between Amazon SQS standard and FIFO queues, SNS standard and FIFO topics, and Amazon MQ.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know Amazon SES in general. It appeared in some questions and answers but not in a detailed way.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;cost-optimization&quot;&gt;Cost Optimization&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Know the differences between Saving Plans, on-demand, reserved, and spot instances.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Learn how to merge EC2 saving plans, compute plans for Fargate and Lambda, Lambda (reserved concurrency or on-demand), and database reserved instances to create a cost-effective solution for a given scenario.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Learn S3 storage classes, such as moving to S3 standard infrequent access or S3 Glacier instant retrieval, to achieve a cost-effective solution in a given scenario.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know cost explorer and cost allocation tags and how to ensure they are included in resources with AWS Config without affecting developers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Know AWS Compute Optimizer in general.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;end-user-computing&quot;&gt;End-user Computing&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Learn use cases of Amazon Workspaces.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Amazon AppStream also appeared in some answers but was not asked directly.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;machine-learning--iot&quot;&gt;Machine Learning &amp;amp; IoT&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;SageMaker appeared in a few questions.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Only IoT Core was in the exam from the AWS IoT services.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;my-exam-experience-with-pearson-vue&quot;&gt;My Exam Experience with Pearson Vue&lt;/h2&gt;

&lt;p&gt;I took the exam from my home office like the previous one with online proctoring from Pearson Vue. As always, I checked in, received a link to take pictures of my environment, and connected to a Vue proctor who checked my desktop and elbows (You shouldn’t wear watches.) before starting the exam.&lt;/p&gt;

&lt;p&gt;The exam experience was smooth. I encountered no issues. Although I didn’t see the exam result immediately, I received it a few hours later.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;After every exam I take, I write my experiences in a blog post. I passed the AWS Certified Solutions Architect Professional for the third time three months ago but had a chance to write about it now. I hope it guides you in the right direction while preparing for it.&lt;/p&gt;

&lt;p&gt;I am also developing courses for AWS certifications. While there are many courses from other successful instructors, my courses will help you by leveraging my years of experience and my teaching style. I will start with the foundational certifications but eventually launch professional ones.&lt;/p&gt;

&lt;p&gt;So, stay tuned. You can also follow me on &lt;a href=&quot;https://www.linkedin.com/in/emre-yilmaz-shikisoft/&quot;&gt;LinkedIn&lt;/a&gt; and &lt;a href=&quot;https://x.com/emrey_shikisoft&quot;&gt;X.com (formerly Twitter)&lt;/a&gt; to be notified when my AWS certification courses are ready.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.credly.com/badges/0380c0b6-3aff-4248-8ab7-b19f6ef24117/&quot;&gt;My AWS Certified Solutions Architect - Professional certificate on Credly!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/20250228-sa-pro/emre-yilmaz-aws-sap-c02-2024-pass.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/20250228-sa-pro/emre-yilmaz-aws-sap-c02-2024-pass.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/20250228-sa-pro/emre-yilmaz-aws-sap-c02-2024-pass.jpg&quot; alt=&quot;Emre Yilmaz - Happy to pass the AWS Certified Solutions Architect – Professional exam for the third time.&quot; width=&quot;1280&quot; height=&quot;944&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;</content><author><name>Emre Yilmaz</name></author><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/20250228-sa-pro/emre-yilmaz-aws-sap-c02-2024-pass.webp" /><media:content medium="image" url="https://blog.shikisoft.com/20250228-sa-pro/emre-yilmaz-aws-sap-c02-2024-pass.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">IaaS vs. PaaS vs. SaaS: Cloud Computing Service Types Explained</title><link href="https://blog.shikisoft.com/cloud-service-types-iaas-paas-saas/" rel="alternate" type="text/html" title="IaaS vs. PaaS vs. SaaS: Cloud Computing Service Types Explained" /><published>2025-01-21T00:00:00+00:00</published><updated>2025-01-21T00:00:00+00:00</updated><id>https://blog.shikisoft.com/cloud-service-types-iaas-paas-saas</id><content type="html" xml:base="https://blog.shikisoft.com/cloud-service-types-iaas-paas-saas/">&lt;p&gt;There are three primary types of cloud computing services, depending on how much management the cloud user or the cloud provider performs. As the level of management increases, so do the responsibilities. These are Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS).&lt;/p&gt;

&lt;p&gt;Generally speaking, ‘X as a Service’ means X is offered to you as a service by a third party. So, in the cloud domain, this can be an infrastructure, a platform, or software provided by the cloud provider, such as Amazon Web Services (AWS). You can leave managing it to the cloud provider and focus on your business.&lt;/p&gt;

&lt;p&gt;In this blog post, I will explain cloud service types and their differences so you can clearly understand your responsibilities.
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;infrastructure-as-a-service-iaas&quot;&gt;Infrastructure as a Service (IaaS)&lt;/h2&gt;

&lt;p&gt;The first cloud service type is &lt;strong&gt;Infrastructure as a Service (IaaS)&lt;/strong&gt;. In this business model, the cloud provider provides essential IT infrastructure, such as compute, storage, and networking, with virtualization.&lt;/p&gt;

&lt;p&gt;You request and configure the necessary resources to run your application, which is often a cloud server with an operating system, some storage, and a network connection. But of course, these can be different resources. In the end, you are billed only for the resources you use. So, you pay as you go.&lt;/p&gt;

&lt;p&gt;It is your job to maintain the operating system and runtime through security patches, etc. Besides, you code, deploy, and support the software application in the long run. You are also responsible for choosing the correct configuration and protecting the data.&lt;/p&gt;

&lt;p&gt;In this model, you are more flexible because you have more control over your cloud resources. The advantage is that you leave infrastructure management to the cloud provider.&lt;/p&gt;

&lt;h3 id=&quot;what-about-examples&quot;&gt;What about examples?&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Amazon EC2&lt;/strong&gt; is a good example of Infrastructure as a Service (IaaS) on AWS. It provides virtual servers as EC2 instances with many configuration options, including compute sizes, storage, networking, etc.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Another example is &lt;strong&gt;Amazon Lightsail&lt;/strong&gt;, which is a simplified version of EC2 instances with packed features and more comprehensible pricing.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In both services, AWS provides a virtual server with the operating system and other components, which you maintain.&lt;/p&gt;

&lt;h2 id=&quot;platform-as-a-service-paas&quot;&gt;Platform as a Service (PaaS)&lt;/h2&gt;

&lt;p&gt;The other primary cloud service type, &lt;strong&gt;Platform as a Service (PaaS)&lt;/strong&gt;, involves the cloud provider taking over some of your management tasks and responsibilities. In PaaS, the cloud provider also manages the operating system and runtimes, as well as the infrastructure and virtualization.&lt;/p&gt;

&lt;p&gt;When a new vulnerability is exposed, the cloud provider patches the operating system for you. So, you don’t have to worry about its maintenance, and AWS has tens of personnel who readily do it for you.&lt;/p&gt;

&lt;p&gt;Your job is coding and deploying your software applications and maintaining them. It is also your responsibility to configure the platform correctly and secure and protect your data with those configurations.&lt;/p&gt;

&lt;h3 id=&quot;what-about-some-examples&quot;&gt;What about some examples?&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The first is &lt;strong&gt;AWS Lambda&lt;/strong&gt;, which allows you to deploy code in supported programming languages and frameworks, such as Node.js, Python, Go, or Ruby, and execute it whenever needed. It also handles all resource provisioning and operating system maintenance.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The other example is &lt;strong&gt;AWS Elastic Beanstalk&lt;/strong&gt;. You provide a software package in a supported platform, such as Ruby on Rails, Node.js Express, Python Django, or Java Tomcat, and let Elastic Beanstalk provision and manage EC2 instances for you.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;software-as-a-service-saas&quot;&gt;Software as a Service (SaaS)&lt;/h2&gt;

&lt;p&gt;The last cloud service type we will cover is &lt;strong&gt;Software as a Service (SaaS)&lt;/strong&gt;. In this business model, the cloud provider performs most of the management tasks, enabling you to focus on your own business.&lt;/p&gt;

&lt;p&gt;The service provider handles all infrastructure management, application deployments, data storage, and maintenance. You don’t need to worry about application development and maintenance or anything related to the lower details. You only use the software through an Internet browser, desktop, or mobile app. You pay for your usage as a subscription or on a pay-as-you-go basis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But don’t you have any responsibilities then?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, you have. Although the service provider manages the data storage, you are still responsible for correctly configuring the service to protect and back up your data.&lt;/p&gt;

&lt;h3 id=&quot;what-about-an-example&quot;&gt;What about an example?&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;AWS WorkMail&lt;/strong&gt; is a fully managed business email and calendar service, like &lt;strong&gt;Google Workspace&lt;/strong&gt;. It is an excellent example of Software as a Service (SaaS) on AWS.&lt;/p&gt;

&lt;p&gt;When using AWS WorkMail, you sign up for a monthly fee and use the service via your browser or an email app like Microsoft Outlook or iOS Mail to check your emails. You don’t care how the app is deployed or where the data is stored.&lt;/p&gt;

&lt;h2 id=&quot;what-about-aws-services&quot;&gt;What about AWS services?&lt;/h2&gt;

&lt;p&gt;Although I have given examples of these cloud computing service types, &lt;strong&gt;many AWS services don’t fall into a single category&lt;/strong&gt;. For example, one can argue that &lt;em&gt;AWS Lambda&lt;/em&gt; is an &lt;em&gt;Infrastructure as a Service (IaaS)&lt;/em&gt; because sometimes you configure its &lt;em&gt;VPC&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;However, if you take &lt;em&gt;VPC&lt;/em&gt; settings in AWS Lambda as a platform configuration, it can still be considered in the &lt;em&gt;Platform as a Service (PaaS)&lt;/em&gt; category. Besides, not all &lt;em&gt;AWS Lambda&lt;/em&gt; functions are required to run in a &lt;em&gt;VPC&lt;/em&gt;. Still, I understand and respect if your view is different.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Cloud computing services have three primary types: &lt;em&gt;Infrastructure as a Service (IaaS)&lt;/em&gt;, &lt;em&gt;Platform as a Service (PaaS)&lt;/em&gt;, or &lt;em&gt;Software as a Service (SaaS)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;You are more flexible but have more responsibilities in &lt;em&gt;Infrastructure as a Service (IaaS)&lt;/em&gt;. In contrast, the cloud provider takes most of the management, deployment, and maintenance jobs from you in &lt;em&gt;Software as a Service (SaaS)&lt;/em&gt;. Regarding responsibilities, &lt;em&gt;Platform as a Service (PaaS)&lt;/em&gt; stays in the middle.&lt;/p&gt;

&lt;p&gt;AWS doesn’t care whether a service fits into one of these categories. It only designs services to address your needs. In addition, AWS doesn’t ask you whether an AWS service is Infrastructure as a Service (IaaS), Platform as a Service (PaaS), or Software as a Service (SaaS) in certification exams.&lt;/p&gt;

&lt;p&gt;What matters is you understand these concepts. In this blog post, I aimed to help you by simplifying them.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and I look forward to seeing you in another blog post! If you’d like to hear more about AWS and cloud computing in general, follow me on &lt;a href=&quot;https://www.linkedin.com/in/emre-yilmaz-shikisoft/&quot;&gt;LinkedIn&lt;/a&gt; and &lt;a href=&quot;https://x.com/emrey_shikisoft&quot;&gt;X (formerly Twitter)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2025-01-cloud-service-types/iaas-paas-saas.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2025-01-cloud-service-types/iaas-paas-saas.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2025-01-cloud-service-types/iaas-paas-saas.jpg&quot; alt=&quot;IaaS vs. PaaS vs. SaaS: Cloud Computing Service Types Explained&quot; width=&quot;1200&quot; height=&quot;644&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2025-01-cloud-service-types/iaas-paas-saas.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2025-01-cloud-service-types/iaas-paas-saas.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Amazon SNS vs. Amazon SQS: A simple comparison</title><link href="https://blog.shikisoft.com/amazon-sns-vs-sqs/" rel="alternate" type="text/html" title="Amazon SNS vs. Amazon SQS: A simple comparison" /><published>2024-12-09T00:00:00+00:00</published><updated>2024-12-09T00:00:00+00:00</updated><id>https://blog.shikisoft.com/amazon-sns-vs-sqs</id><content type="html" xml:base="https://blog.shikisoft.com/amazon-sns-vs-sqs/">&lt;p&gt;When it comes to building a reliable and scalable cloud infrastructure, efficient communication between your cloud components is essential. There are many AWS services to help you build a reliable communication architecture for your solution. So, in this post, we will discuss and compare two old and popular AWS messaging services, Amazon Simple Notification Service (SNS) and Amazon Simple Queue Service (SQS). These services allow you to easily exchange messages in a distributed system.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Amazon SNS and Amazon SQS are fully managed and serverless AWS services that offer automated communication. While they may sound similar, they each have unique features that set them apart. In the following sections, we will delve into these features, providing a comprehensive understanding of each service. Let’s start with Amazon SNS.&lt;/p&gt;

&lt;h2 id=&quot;amazon-sns-is-push-based&quot;&gt;Amazon SNS is push-based!&lt;/h2&gt;

&lt;p&gt;The delivery method is the first and most notable difference between Amazon SNS and Amazon SQS. SNS uses an instant ‘push’ mechanism. This means messages are automatically delivered to the subscribed consumers, and you don’t need to check for or ‘poll’ updates. It sends copies of the same message to multiple consumers via topics.&lt;/p&gt;

&lt;p&gt;Amazon SNS supports both application-to-application (A2A) communication (with AWS Lambda, AWS SQS, etc.) and application-to-person (A2P) communication (with email, SMS, etc.). Using Amazon SNS, you can build apps that receive push notifications or notify humans to react to system events.&lt;/p&gt;

&lt;p&gt;For example, you can subscribe an AWS Lambda function to an SNS topic, which can do custom processing when receiving a message. You can also subscribe an email address to the same topic to be notified about this event. SNS also allows you to send SMS or mobile push notifications via platform-specific services, such as Apple Push Notification Serves for messages to iOS and macOS apps.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-use-cases.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-use-cases.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-use-cases.jpg&quot; alt=&quot;Amazon SNS use cases&quot; width=&quot;1394&quot; height=&quot;960&quot; /&gt;
    
&lt;/picture&gt;

&lt;h2 id=&quot;what-is-an-sns-topic&quot;&gt;What is an SNS topic?&lt;/h2&gt;

&lt;p&gt;On Amazon SNS, messaging revolves around three main components: the SNS topic, the publisher, and the subscriber. The SNS topic serves as a logical access point where you can group multiple endpoints such as HTTPS, an email address, AWS Lambda, or an Amazon SQS queue. When you name an SNS topic, the service understands which endpoints you want to send messages to. Consumers who wish to receive notifications must subscribe to relevant topics. Multiple consumers can subscribe to a single topic, and multiple publishers can send messages. When a publisher sends a message to a topic, all subscribed clients are immediately notified. However, the publisher and the subscriber must have the necessary IAM permissions.&lt;/p&gt;

&lt;h3 id=&quot;there-are-two-types-of-sns-topics-standard-and-fifo&quot;&gt;There are two types of SNS topics: Standard and FIFO.&lt;/h3&gt;

&lt;p&gt;Amazon SNS offers two different topic types: standard topics and FIFO (first in, first out) topics. When using standard topics, messages can be targeted to many endpoints, such as an email address, text messaging (SMS), AWS Lambda, etc. However, messages are not guaranteed to be delivered in the order received by Amazon SNS. Standard SNS topics perform at least once delivery. So, your endpoints must be ready for duplicate messages.&lt;/p&gt;

&lt;p&gt;With FIFO topics, you can guarantee strict message ordering in the order received by your topic. But you can only subscribe SQS queues to a FIFO SNS topic and not other endpoints. The messages sent to a FIFO topic are delivered to subscribed SQS queues exactly once.&lt;/p&gt;

&lt;p&gt;Let’s leave comparing SNS topic types to another blog post. You can easily set your SNS topic type while creating a topic on your AWS console:&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-topic-type-selection.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-topic-type-selection.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-topic-type-selection.jpg&quot; alt=&quot;Selecting the Amazon SNS topic type&quot; width=&quot;1500&quot; height=&quot;677&quot; /&gt;
    
&lt;/picture&gt;

&lt;h2 id=&quot;amazon-sqs-uses-a-pull-mechanism&quot;&gt;Amazon SQS uses a pull mechanism!&lt;/h2&gt;

&lt;p&gt;We mentioned the main features of Amazon SNS above. Now, let’s have a look at Amazon SQS.&lt;/p&gt;

&lt;p&gt;Unlike Amazon SNS, Amazon SQS uses a ‘polling’ model, which means messages are not automatically pushed. Instead, they are stored in a queue until the consumer pulls and processes messages from the queue.&lt;/p&gt;

&lt;p&gt;Amazon SQS is especially suitable for processing large numbers of messages since it allows for parallel processing with multiple queues. It is generally used to decouple distributed systems, microservices, etc. This enables asynchronous communication between different components. So, using SQS queues can boost your user experience as multiple workloads can be independently processed simultaneously.&lt;/p&gt;

&lt;p&gt;For example, I used SQS queues in the past to queue image-processing jobs and indexing jobs for Elasticsearch (Amazon OpenSearch now). In each use case, I implemented AWS Lambda functions to process the images or trigger the indexing operation on the Elasticsearch domain. It was a Rails application, and I replaced Sidekiq workers on EC2 instances with this solution. Not only I decoupled my app and job servers, but I also migrated the background jobs to a cost-effective, reliable and scalable serverless architecture.&lt;/p&gt;

&lt;p&gt;The diagram below displays how messages are delivered to consumers through Amazon SQS:&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sqs-use-cases.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sqs-use-cases.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sqs-use-cases.jpg&quot; alt=&quot;Amazon SQS use cases&quot; width=&quot;1515&quot; height=&quot;765&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Besides, Amazon SQS has the advantage of persisting of your messages. Messages can stay in the queue for up to 14 days, providing better reliability than Amazon SNS. Also, unlike Amazon SNS, only one consumer can process messages at a time, and it only supports A2A communication. You can easily customize the settings of an Amazon SQS queue, such as message retention period, maximum message size, etc.&lt;/p&gt;

&lt;h3 id=&quot;variants-of-sqs-queue-types&quot;&gt;Variants of SQS Queue Types&lt;/h3&gt;

&lt;p&gt;Like Amazon SNS, you can use standard and FIFO queues in Amazon SQS. When you use standard queues, messages will be delivered in no guaranteed order. If you need message ordering, you can create FIFO (first in, first out) queues. They enable the messages to be delivered in the same order they are sent to the queue.&lt;/p&gt;

&lt;p&gt;You can use delay queues to postpone the delivery of your messages for a specific time. Besides, Amazon SQS offers dead letter queues to route the messages that can’t be processed due to a failure to be reprocessed later. These features increases reliability of your applications.&lt;/p&gt;

&lt;h2 id=&quot;which-solution-would-be-best-for-your-need&quot;&gt;Which solution would be best for your need?&lt;/h2&gt;

&lt;p&gt;We analyzed each service. But how can you decide which one suits your use case best? Let’s focus on the main factors you should take into consideration:&lt;/p&gt;

&lt;p&gt;1)	First and foremost, Amazon SNS and Amazon SQS serve different purposes and operate in distinct ways.&lt;/p&gt;

&lt;p&gt;Amazon SNS excels at sending multiple copies of messages to numerous subscribers, making it ideal for notifications, updates, reminders, and alerts. For instance, you can use Amazon SNS to inform subscribers about marketing campaigns or notifying your personnel on CloudWatch alarms.&lt;/p&gt;

&lt;p&gt;On the other hand, Amazon SQS is designed to decouple distributed systems, making it the preferred choice for applications that require asynchronous communication between various components.&lt;/p&gt;

&lt;p&gt;2)	On Amazon SQS, only one consumer can process a message. Also, Amazon SQS allows for batch processing; sending ten messages in one batch is possible. However, messages cannot be sent in batches with Amazon SNS; one message is forwarded to multiple consumers.&lt;/p&gt;

&lt;p&gt;3)	If you want to be sure your message is delivered to your consumer, you should choose Amazon SQS. Exact delivery is ensured with Amazon SQS in most cases. However, with Amazon SNS, there is no certainty that your message will reach a consumer if the consumer is unavailable for some reason. It can be deleted without consumer receiving the message. So, if reliability is your priority, then you should go with Amazon SQS, which provides message persistency and features like dead-letter queues.&lt;/p&gt;

&lt;p&gt;4)	If latency is an issue, consider using Amazon SNS. Although Amazon SQS offers better reliability and persistence, its performance speed is slightly lower than Amazon SNS. The reason is that messages need to be polled in Amazon SQS, which takes extra time, while they are immediately pushed with Amazon SNS.&lt;/p&gt;

&lt;h2 id=&quot;combination-of-sns-and-sqs-the-fanout-pattern&quot;&gt;Combination of SNS and SQS: The Fanout Pattern&lt;/h2&gt;

&lt;p&gt;Despite their differences, Amazon SNS and Amazon SQS can complement each other effectively. When used in a fanout pattern, they can significantly enhance performance. This approach leverages SQS’s asynchronous message processing capability, leading to a more efficient system.&lt;/p&gt;

&lt;p&gt;In the fanout pattern, a message published to an SNS topic is sent to many SQS queues simultaneously. To fan out messages to SQS queues, you must first create a standard SNS topic. Then, subscribe the SQS queues to that SNS topic. After that, the message will be delivered to all SQS queues subscribed to the topic. This enables parallel message processing.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-sqs-fanout.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-sqs-fanout.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-sqs-fanout.jpg&quot; alt=&quot;Amazon SNS and SQS - Fanout Pattern&quot; width=&quot;1554&quot; height=&quot;863&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Let’s clarify this more with a typical example. Let’s say you use Amazon SNS and Amazon SQS together, and suppose you have an application that allows users to upload photos. When a user uploads an image, a message is published to an SNS topic, which will then trigger multiple SQS queues for various tasks. This means that each process, such as image recognition or thumbnail creation, can be performed in parallel, saving time and improving user experience. Your users won’t have to wait for each process to be completed because they will all be handled in the background. This can be a more efficient and user-friendly solution in such cases.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;In this post, we discussed the key features of AWS’s two popular services: Amazon SNS and Amazon SQS. We described their different use cases and functions.&lt;/p&gt;

&lt;p&gt;To sum up, Amazon SNS is a push notification service usually used to send quick notifications to multiple subscribers. On the other hand, Amazon SQS is a reliable queue-type messaging solution with a pull mechanism. Moreover, in some cases, combining them can be more efficient.&lt;/p&gt;

&lt;p&gt;I hope this post helps you understand better the main characteristics of Amazon SNS and Amazon SQS. Thank you for reading! I look forward to seeing you in our other posts.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html&quot;&gt;What is Amazon SQS? - AWS Docs &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/sns/latest/dg/welcome.html&quot;&gt;What is Amazon SNS? - AWS Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-vs-sqs.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-vs-sqs.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2024-12-sns-sqs/amazon-sns-vs-sqs.jpg&quot; alt=&quot;Amazon SNS vs. Amazon SQS: A simple comparison&quot; width=&quot;1080&quot; height=&quot;1080&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="Amazon SNS" /><category term="Amazon SQS" /><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2024-12-sns-sqs/amazon-sns-vs-sqs.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2024-12-sns-sqs/amazon-sns-vs-sqs.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">AWS Certified DevOps Engineer – Professional for the Third Time!</title><link href="https://blog.shikisoft.com/passed-aws-certified-devops-engineer-professional-2024/" rel="alternate" type="text/html" title="AWS Certified DevOps Engineer – Professional for the Third Time!" /><published>2024-10-01T00:00:00+00:00</published><updated>2024-10-01T00:00:00+00:00</updated><id>https://blog.shikisoft.com/passed-aws-certified-devops-engineer-professional-2024</id><content type="html" xml:base="https://blog.shikisoft.com/passed-aws-certified-devops-engineer-professional-2024/">&lt;p&gt;Recently, I recertified my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Certified DevOps Engineer – Professional&lt;/code&gt; (DOP-C02) certification by sitting for the exam for the third time. So, I extended my DevOps Pro certification to 9 years and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Certified Developer – Associate&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Certified SysOps Administrator – Associate&lt;/code&gt; certifications to 10 years. It was a long marathon.&lt;/p&gt;

&lt;p&gt;You need to recertify your AWS certifications in every three years. Although it was my third exam for this certification, it was still hard, and I learned new things during preparation. So, let me give you some insights about the exam coverage, how I prepared, and how online proctoring went with Pearson Vue.
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-exam-content&quot;&gt;The exam content&lt;/h2&gt;

&lt;p&gt;I don’t know you, but I don’t enjoy taking exams. However, AWS updates the exam content with new services and best practices every few years, so preparation keeps you updated. I learn new things each time and can see how the AWS platform evolves along the way. Besides, passing the exam boosts your confidence and verifies your knowledge.&lt;/p&gt;

&lt;h3 id=&quot;so-how-was-it-different-this-time&quot;&gt;So, how was it different this time?&lt;/h3&gt;

&lt;p&gt;Well, &lt;a href=&quot;/passed-aws-solutions-architect-professional-hold-all-5-core/&quot;&gt;in my first exam in 2018&lt;/a&gt;, the focus was on CloudFormation, ElasticBeanstalk, AWS OpsWorks, and EC2 AutoScaling Groups for performing Blue/Green deployments.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/passed-aws-certified-devops-engineer-professional/&quot;&gt;This changed in 2021&lt;/a&gt; with the addition of AWS developer tools. AWS CloudFormation was still essential, but AWS CodePipeline, AWS CodeDeploy, AWS CodeBuild, and AWS CodeCommit had crucial shares. There were questions about ElasticBeanstalk and OpsWorks in a reduced capacity. Serverless application deployments with AWS Lambda, API Gateway, and Step Functions were introduced. Some new services, such as Systems Manager, Service Catalog, AWS Config, and Inspector, were also in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The main difference in 2024 was the exam’s focus on multi-account AWS architectures with Organizations.&lt;/strong&gt; For most of the services, you should know how to configure it for your organization in a multi-account setting. This is because, nowadays, using multiple accounts for different purposes is one of the primary AWS best practices.&lt;/p&gt;

&lt;h3 id=&quot;some-of-the-topics-covered-in-the-exam&quot;&gt;Some of the topics covered in the exam&lt;/h3&gt;

&lt;p&gt;Here are some of the topics I encountered during the exam. Of course, the list is not full. Knowing the services well should be your goal.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;You should know how to configure multi-account AWS architectures through &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Organizations&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Control Tower&lt;/code&gt;, and other services.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;You should know how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CodeBuild&lt;/code&gt; works and how to perform specific tasks, such as image signing with AWS Signer.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Understanding the capabilities of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CodeDeploy&lt;/code&gt; and the deployment lifecycles for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EC2&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Lambda&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ECS&lt;/code&gt; deployments is crucial.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Unlike 2021, AWS CodeBuild and CodeDeploy were often asked with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CodePipeline&lt;/code&gt;. Using CodePipeline with CloudFormation, manual approval actions, and usage of action variables were significant. I am proud to say my &lt;a href=&quot;https://www.udemy.com/course/aws-codepipeline-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CodePipeline Step by Step&lt;/a&gt; course covers a considerable amount, although it is not tailored for the exam.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Of course, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CloudFormation&lt;/code&gt; is still crucial. However, this time, I didn’t see questions about advanced topics like resource policies or stack policies. I often saw it in conjunction with other services like CodePipeline, Service Catalog, etc.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CDK&lt;/code&gt; and integrating it into a pipeline was important.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I saw &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CodeArtifact&lt;/code&gt; a few times. You should understand how it works and how to use it in a multi-account setting.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;For monitoring and alerting, you should know &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CloudWatch&lt;/code&gt; metrics and logs, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CloudTrail&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EventBridge&lt;/code&gt; in detail.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Amazon ECS&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ECR&lt;/code&gt; were critical. However, there were also questions about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Amazon EKS&lt;/code&gt;, too. The questions focused on integrating EKS with other AWS services or within an AWS Organization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using and mounting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EFS&lt;/code&gt; volumes are essential.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step Functions&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;API Gateway&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Lambda&lt;/code&gt; and their deployment types are crucial.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Config&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Systems Manager&lt;/code&gt; are still crucial. I was expecting more about SSM and its excellent features. AWS may focus on it more in the upcoming exams.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The exam included security services like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KMS&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GuardDuty&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS WAF&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Inspector&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Macie&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Network Firewall&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Many other questions appeared regarding disaster recovery and backup scenarios involving &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Aurora&lt;/code&gt;databases and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DynamoDB&lt;/code&gt; tables.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Route 53&lt;/code&gt; is still essential as it is the DNS service that helps you in multi-account, multi-region scenarios.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The questions also included &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Amazon Athena&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Glue&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;QuickSight&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpenSearch&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SQS&lt;/code&gt; (DLQs), &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SNS&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Kinesis Data Firehose&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;AWS deprecated &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OpsWorks&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CodeCommit&lt;/code&gt;. I only saw CodeCommit in a CodePipeline question, but just as a source action. It wasn’t important for the question. So, if you know CodePipeline well, you can easily discard it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;The most significant change is that I didn’t see a single question about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ElasticBeanstalk&lt;/code&gt;. It was a lovely service when it was launched, but other AWS services offer better DevOps features, so I was expecting that.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I was amazed at how AWS changed the goal of each question. Knowing how to use an AWS service with others in a multi-account organization is more crucial than ever. The exam focuses on more hands-on practice and less on memorizing.&lt;/p&gt;

&lt;p&gt;The questions were often long, and there were many questions where you chose three from six options. As always, even if you don’t know an option exactly, knowing that other options are impossible can help you solve the questions through elimination.&lt;/p&gt;

&lt;h2 id=&quot;online-proctoring-with-pearson-vue&quot;&gt;Online Proctoring with Pearson Vue&lt;/h2&gt;

&lt;p&gt;I work from my home office, so taking courses from the comfort of my office is a blessing. That is why I chose online proctoring for the exam. Here is the process.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Before 30 minutes, I started the exam check-in process, which ran standard tests like open applications and internet speed on my computer through the OnVue app.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;It sent me a link as a text message, asking me to take a photo of myself, my ID, and my desk from several angles.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Then, the proctor greeted me and asked me to show my wrists and desk using the webcam.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;She started the exam. I never left the camera view.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;As a non-native English speaker, I took an extra 30 minutes of ESL. However, I finished the exam 20 minutes early. So, I only used 10 minutes from it.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, I had a positive experience. However, the text size was a little smaller and not easy on my eyes, which caused me to be fatigued in the middle of the exam.&lt;/p&gt;

&lt;h2 id=&quot;the-result-and-exam-score&quot;&gt;The Result and Exam Score&lt;/h2&gt;

&lt;p&gt;Surprisingly, the exam page didn’t show whether I passed after I finished. This was my eighth AWS exam, consisting of 3 Associate and 5 Professional levels. It showed the exam result with the ‘Passed’ word in the past. This was the first time I didn’t know the exam result immediately after finishing.
I saw the result approximately nine hours later in my AWS certification account. After searching the Internet, I learned this is the standard process nowadays. However, knowing that I passed the exam immediately was a relief in the past after the exam fatigue. I really missed it.&lt;/p&gt;

&lt;p&gt;I got &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;883/1000&lt;/code&gt; by using &lt;strong&gt;only AWS documentation and practicing myself&lt;/strong&gt;, as I will discuss my preparation method below. Due to exam fatigue, I missed two easy questions regarding CloudWatch Logs—S3 integration, which would have taken me over 900. Still, I am happy that I passed it with a decent score, where only 750 points would be sufficient.&lt;/p&gt;

&lt;h2 id=&quot;how-did-i-prepare&quot;&gt;How did I prepare?&lt;/h2&gt;

&lt;p&gt;I know you want a quick way to prepare for the exam. I’m sorry, but you won’t get an easy answer from me. I didn’t use any online courses or practice exams.&lt;/p&gt;

&lt;p&gt;Knowing the services well and becoming an expert on the topics were more important for me. This is why I didn’t watch any online courses, which often require you to memorize topics. Besides, I am a course creator, so I wanted to understand AWS’s focus on best practices in the exam. I am considering a course focusing on those.&lt;/p&gt;

&lt;p&gt;I don’t find the existing practice exams relevant because they often contain confusing answers. They want you to memorize exam questions.&lt;/p&gt;

&lt;p&gt;So, how did I prepare?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I read many AWS whitepapers while taking notes. Here are some:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/welcome.html&quot;&gt;Operational Excellence&lt;/a&gt;, &lt;a href=&quot;https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/welcome.html&quot;&gt;Reliability&lt;/a&gt;, and &lt;a href=&quot;https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html&quot;&gt;Security&lt;/a&gt; pillars of AWS Well-Architected Framework&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/introduction-devops-aws/introduction-to-devops.html&quot;&gt;Introduction to DevOps on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/practicing-continuous-integration-continuous-delivery/welcome.html&quot;&gt;Practicing Continuous Integration and Continuous Delivery on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/overview-deployment-options/welcome.html&quot;&gt;Overview of Deployment Options on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/blue-green-deployments/welcome.html&quot;&gt;Blue/Green Deployments on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/development-and-test-on-aws/development-and-test-on-aws.html&quot;&gt;Development and Test on Amazon Web Services&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/disaster-recovery-workloads-on-aws/disaster-recovery-workloads-on-aws.html&quot;&gt;Disaster Recovery of Workloads on AWS: Recovery in the Cloud&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/aws-multi-region-fundamentals/aws-multi-region-fundamentals.html&quot;&gt;AWS Multi-Region Fundamentals&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/running-containerized-microservices/welcome.html&quot;&gt;Running Containerized Microservices on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/microservices-on-aws/microservices-on-aws.html&quot;&gt;Implementing Microservices on AWS&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/whitepapers/latest/containers-on-aws/containers-on-aws.html&quot;&gt;Containers on AWS&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I tried to learn each service covered in &lt;a href=&quot;https://d1.awsstatic.com/training-and-certification/docs-devops-pro/AWS-Certified-DevOps-Engineer-Professional_Exam-Guide.pdf&quot;&gt;the exam blueprint&lt;/a&gt; by reading their documentation and making hands-on examples with them.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I watched many AWS Re:Invent videos from 2022 and 2023.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;I summarized what I learned in Word documents to review later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, as the creator of &lt;a href=&quot;https://courses.shikisoft.com&quot;&gt;courses about crucial services like CodePipeline, CloudFormation, and CDK&lt;/a&gt;, I already have vast knowledge of these topics.&lt;/p&gt;

&lt;p&gt;I can’t say enough how my over ten years of AWS experience helped me during the exam. Sometimes, you just know something doesn’t add up through experience.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Certified DevOps Engineer – Professional&lt;/code&gt; is one of the most valuable certifications in the cloud domain. I am glad to see how much hands-on practice is required to pass it. Passing this certification for the third time in the last six years was quite an experience for me. Each time I learned new things, the questions became more complex. However, if you know your domain well, you can pass the exam regardless.&lt;/p&gt;

&lt;p&gt;Now, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Certified Solutions Architect – Professional&lt;/code&gt; recertification for the third time is on my radar. After that, I am planning to build more content for both exams with new courses to help you. So, follow me on &lt;a href=&quot;https://www.linkedin.com/in/emre-yilmaz-shikisoft/&quot;&gt;LinkedIn&lt;/a&gt; and &lt;a href=&quot;https://x.com/emrey_shikisoft&quot;&gt;X (Twitter)&lt;/a&gt; to stay tuned.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.credly.com/badges/b7a0aed9-418a-4b15-84d7-e0be9f14d707/public_url&quot;&gt;My AWS Certified DevOps Engineer - Professional certificate on Credly!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-dop/aws-dop-third-pass.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-dop/aws-dop-third-pass.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2024-dop/aws-dop-third-pass.jpg&quot; alt=&quot;Third time! AWS Certified DevOps Engineer - Professional&quot; width=&quot;1200&quot; height=&quot;675&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;</content><author><name>Emre Yilmaz</name></author><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2024-dop/aws-dop-third-pass.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2024-dop/aws-dop-third-pass.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Using AWS CodeArtifact with AWS CodeBuild: An Angular Build Example</title><link href="https://blog.shikisoft.com/using-aws-codeartifact-with-codebuild/" rel="alternate" type="text/html" title="Using AWS CodeArtifact with AWS CodeBuild: An Angular Build Example" /><published>2024-08-28T00:00:00+00:00</published><updated>2024-08-28T00:00:00+00:00</updated><id>https://blog.shikisoft.com/using-aws-codeartifact-with-codebuild</id><content type="html" xml:base="https://blog.shikisoft.com/using-aws-codeartifact-with-codebuild/">&lt;p&gt;AWS CodeArtifact enables you to store your custom packages or fetch packages from public package registries and use them in your software development process. If you use AWS CodeBuild to build your code, you can make CodeBuild retrieve the packages required for your build or test commands from your CodeArtifact repository on AWS instead of public Internet registries.&lt;/p&gt;

&lt;p&gt;In this post, I will introduce you to AWS CodeArtifact and provide an example of using it with AWS CodeBuild to build an Angular application. 
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-aws-codeartifact&quot;&gt;What is AWS CodeArtifact?&lt;/h2&gt;

&lt;p&gt;AWS CodeArtifact is a serverless package management service provided by AWS. It helps you store, publish, and share software packages using popular package management tools like npm, pip, Maven, RubyGems, etc. You can store your custom packages or packages from language-native public registries in your CodeArtifact repositories.&lt;/p&gt;

&lt;h2 id=&quot;why-use-aws-codeartifact&quot;&gt;Why use AWS CodeArtifact?&lt;/h2&gt;

&lt;p&gt;If you need a central package management solution, maintaining and scaling your own system is costly, time-consuming, and challenging. Instead, you can use AWS CodeArtifact to let AWS manage it for you.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;AWS CodeArtifact is serverless. It is hosted on Amazon S3 and DynamoDB tables. Not only does CodeArtifact free you from the server management burden, but it also redundantly stores your repository data in multiple AZs and automatically scales your repositories based on demand theoretically without limits. Hence, AWS CodeArtifact provides durability and high availability out of the box.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;It is cost-effective. You only pay for the storage used, the number of requests made, and data transferred out of an AWS region. Besides, the AWS free tier provides 2GB of storage and 100,000 requests per month for free.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;It is secure. The data is encrypted at rest with KMS keys, which can be customer-managed or AWS-managed. The data in transit is encrypted with TLS encryption. You use IAM roles and resource policies on your CodeArtifact repositories to control who can access them.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;It is integrated with CloudTrail, so you can log who accessed and when for each action taken on your CodeArtifact repositories.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;You can create a single CodeArtifact domain within your AWS organization and share it with multiple AWS accounts as a central location for your packages.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, what are CodeArtifact domains and repositories? So, let’s continue with AWS CodeArtifact’s primary concepts.&lt;/p&gt;

&lt;h2 id=&quot;aws-codeartifact--primary-concepts&quot;&gt;AWS CodeArtifact – Primary concepts&lt;/h2&gt;

&lt;h3 id=&quot;asset&quot;&gt;Asset&lt;/h3&gt;

&lt;p&gt;The individual files representing packages are called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;assets&lt;/code&gt; in CodeArtifact. It is what you download and store when you fetch a package from a package management service. For example, ‘package.tgz’ files in npm packages are CodeArtifact assets.&lt;/p&gt;

&lt;h3 id=&quot;package&quot;&gt;Package&lt;/h3&gt;

&lt;p&gt;A package represents a bundle of software with its dependencies. When you install a package, you actually install a package version, which consists of a version number, such as ‘1.5.2’, a metadata and a set of assets.&lt;/p&gt;

&lt;h3 id=&quot;repository&quot;&gt;Repository&lt;/h3&gt;

&lt;p&gt;A CodeArtifact repository is the primary place to store and fetch packages on CodeArtifact. It is a set of package versions from the same or different package registries. For example, you can install packages from npm or PyPi in the same CodeArtifact repository.&lt;/p&gt;

&lt;p&gt;If a repository has packages accessed from a second repository, it becomes an upstream repository. For example, if your CodeArtifact repository has package versions from npm, CodeArtifact creates a special repository to download packages from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm&lt;/code&gt;. This npm repository becomes an upstream repository, and your repository becomes a downstream.&lt;/p&gt;

&lt;h3 id=&quot;domain&quot;&gt;Domain&lt;/h3&gt;

&lt;p&gt;Finally, domains are top-level CodeArtifact constructs that group and manage multiple repositories. You define external and internal repositories in CodeArtifact domains and access them through your domains.&lt;/p&gt;

&lt;p&gt;Domains also allow you to use organization policies to share your repositories between your AWS accounts. For example, you can create a CodeArtifact domain for your production environment in an AWS account in your AWS organization and use it as the central domain for your software packages in other AWS accounts. So your teams can access them easily.&lt;/p&gt;

&lt;p&gt;All package versions are stored in CodeArtifact domains. For example, if two repositories in your domain reference the same package version, only one copy of the package asset is stored in the domain. It doesn’t matter how many repositories reference it. This avoids unnecessary duplicates in your domain.&lt;/p&gt;

&lt;h2 id=&quot;what-is-aws-codebuild&quot;&gt;What is AWS CodeBuild?&lt;/h2&gt;

&lt;p&gt;AWS CodeBuild is a fully managed and serverless continuous integration service. With CodeBuild, you can build and test your code from your source Git repository hosted on GitHub, GitHub Enterprise, Bitbucket, GitLab, or GitLab self-managed. It also supports AWS CodeCommit, but AWS deprecated it in July 2024.&lt;/p&gt;

&lt;p&gt;I won’t dive into the details of AWS CodeBuild in this post. If you want to learn AWS CodeBuild, you’re welcome to join my &lt;a href=&quot;https://www.udemy.com/course/aws-codepipeline-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CodePipeline Step by Step&lt;/a&gt; course. Now, let’s continue with using AWS CodeArtifact with AWS CodeBuild.&lt;/p&gt;

&lt;h2 id=&quot;how-do-you-use-aws-codeartifact-repositories-in-a-codebuild-project&quot;&gt;How do you use AWS CodeArtifact repositories in a CodeBuild project?&lt;/h2&gt;

&lt;p&gt;There are a few common steps for using AWS CodeArtifact:&lt;/p&gt;

&lt;p&gt;1)	You create a CodeAritfact domain and a repository.&lt;/p&gt;

&lt;p&gt;2)	You assign necessary IAM permissions to the IAM identity, which will store packages to or download packages from your CodeArtifact repository.&lt;/p&gt;

&lt;p&gt;3)	You log in to your CodeArtifact repository using AWS CLI. The documentation refers to it as CodeArtifact CLI, but you install it with AWS CLI, and its usage is similar to that of other commands. So, I will refer to it as AWS CLI.&lt;/p&gt;

&lt;p&gt;4)	You publish your package or install a package using language-native tools such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm publish&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install&lt;/code&gt;, respectively.&lt;/p&gt;

&lt;h3 id=&quot;step-1---preparing-your-codearifact-domain-and-repository&quot;&gt;Step 1 - Preparing your CodeArifact domain and repository&lt;/h3&gt;

&lt;p&gt;To begin with, you create a CodeArtifact domain that will host all your CodeArtifact repositories and package versions.&lt;/p&gt;

&lt;p&gt;In the example below, I create a CodeArtifact domain named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-demo-domain&lt;/code&gt;.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-creation.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-creation.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-creation.jpg&quot; alt=&quot;Creating a CodeArtifact domain&quot; width=&quot;1280&quot; height=&quot;742&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Then, you create a new repository in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CodeArtifact domain&lt;/code&gt; and choose its upstream repositories from the popular central package registries.&lt;/p&gt;

&lt;p&gt;Your repository must be created in a CodeArtifact domain. If you don’t yet have a domain, you can create it while creating your repository on the CodeArtifact Console. However, you can create a repository in an existing domain by clicking the ‘Create repository’ button, as shown below.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-from-domain.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-from-domain.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-from-domain.jpg&quot; alt=&quot;Creating a CodeArtifact repository in a domain&quot; width=&quot;1280&quot; height=&quot;496&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;In the example below, I create a repository named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-demo-repository&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-demo-domain&lt;/code&gt; created before. Although our sample project only needs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm-store (JavaScript)&lt;/code&gt; to install the required Node packages, I also added &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PyPi (Python)&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RubyGems (Ruby)&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Maven Central Repository (Java)&lt;/code&gt; registries as upstream repositories to my repository as an example.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-creation.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-creation.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-repository-creation.jpg&quot; alt=&quot;AWS CodeArtifact repository creation with upstream repos&quot; width=&quot;1280&quot; height=&quot;921&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;These are repositories with external connections, and CodeArtifact uses them to store package versions from the Internet. Because they are defined as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;upstream&lt;/code&gt; for your repository, it can also access their packages. However, you can store your own packages in your repository directly.&lt;/p&gt;

&lt;p&gt;On the review page, CodeArtifact shows the upstream and downstream repositories with a nice diagram.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-upstream-downstream.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-upstream-downstream.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-upstream-downstream.jpg&quot; alt=&quot;Upstream and downstream repositories on AWS CodeArtifact&quot; width=&quot;1280&quot; height=&quot;829&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;In this diagram, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;maven-central-store&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rubygems-store&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm-store&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pypi-store&lt;/code&gt; repositories were added as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;upstream&lt;/code&gt; repositories. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-demo-repository&lt;/code&gt; is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;downstream&lt;/code&gt; repository that automatically has access to the package versions in them.&lt;/p&gt;

&lt;p&gt;After the creation, your CodeArtifact domain will have five repositories as below.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-post-repository-creation.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-post-repository-creation.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-domain-post-repository-creation.jpg&quot; alt=&quot;An AWS CodeArtifact domain after the repository creation&quot; width=&quot;1280&quot; height=&quot;771&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;At the beginning, your CodeArtifact repository doesn’t have any packages.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-demo-repo.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-demo-repo.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-demo-repo.jpg&quot; alt=&quot;Empty CodeArtifact repository&quot; width=&quot;1280&quot; height=&quot;666&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Angular applications use Node packages. So, during the build, we expect CodeBuild to fetch some Node packages from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm&lt;/code&gt; and store them in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm-store&lt;/code&gt; repository. However, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm-store&lt;/code&gt; repository on CodeArtifact is empty beforehand.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-npm-store.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-npm-store.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-empty-npm-store.jpg&quot; alt=&quot;Empty CodeArtifact upstream npm-store repository&quot; width=&quot;1280&quot; height=&quot;698&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;So, let’s see what happens after integrating it with AWS CodeBuild running a build.&lt;/p&gt;

&lt;h3 id=&quot;step-2--creating-your-codebuild-project&quot;&gt;Step 2 – Creating your CodeBuild project&lt;/h3&gt;

&lt;p&gt;This part is almost the same as using AWS CodeBuild without CodeArtifact. Your CodeBuild project’s source can be any of the source repositories supported. It can also be a part of a CodePipeline build action, which you can learn in my &lt;a href=&quot;https://www.udemy.com/course/aws-codepipeline-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CodePipeline Step by Step&lt;/a&gt; course on Udemy.&lt;/p&gt;

&lt;p&gt;In the example for this blog post, I use a buildspec file to build an Angular application. I won’t embed the CodeArtifact domain and repository names or AWS account ID in the buildspec file. Instead, I recommend using environment variables. So, in the example below, I create these environment variables in my CodeBuild project:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;CODEARTIFACT_DOMAIN:&lt;/strong&gt; The name of your CodeArtifact domain. In my example, it is ‘my-demo-domain’.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;CODEARTIFACT_REPO:&lt;/strong&gt; The name of your CodeArtifact repository, which is ‘my-demo-repository’ in my example.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;CODEARTIFACT_OWNER:&lt;/strong&gt; The AWS account ID of the owner of the repository. It will be my account ID, but it can also be from a different AWS account whose repository is configured for cross-account access.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The environment variables on CodeBuild look like the image below. You can learn to use environment variables in CodeBuild from my previous post about the subject.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-codebuild-env-vars.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-codebuild-env-vars.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-codebuild-env-vars.jpg&quot; alt=&quot;CodeBuild environment variables for CodeArtifact&quot; width=&quot;1280&quot; height=&quot;320&quot; /&gt;
    
&lt;/picture&gt;

&lt;h3 id=&quot;step-3---granting-your-codebuild-project-necessary-permissions&quot;&gt;Step 3 –  Granting your CodeBuild project necessary permissions&lt;/h3&gt;

&lt;p&gt;Your CodeBuild project won’t have permission to access CodeArtifact after the creation. So, you should provide permission to log in to CodeArtifact and access your CodeArtifact domain and repositories in its IAM service role.&lt;/p&gt;

&lt;p&gt;You can create a customer-managed IAM policy with the permissions below.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2012-10-17&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Statement&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Effect&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Allow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Action&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;codeartifact:GetAuthorizationToken&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;codeartifact:GetRepositoryEndpoint&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;codeartifact:ReadFromRepository&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Resource&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Effect&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Allow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Action&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sts:GetServiceBearerToken&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Resource&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Condition&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;StringEquals&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;sts:AWSServiceName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;codeartifact.amazonaws.com&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then, you should assign it to your CodeBuild project’s IAM role.&lt;/p&gt;

&lt;h3 id=&quot;step-4--adding-codeartifact-login-command-to-your-buildspec-file&quot;&gt;Step 4 – Adding CodeArtifact login command to your buildspec file&lt;/h3&gt;

&lt;p&gt;In CodeBuild, you provide the commands to build or test your code in your buildspecs. A buildspec consists of these optional phases in the order they are executed: install, pre_build, build, and post_build.&lt;/p&gt;

&lt;p&gt;Usually, the pre_build phase is where you log in to central repositories, such as DockerHub or Amazon ECR. However, in the install phase before pre_build, you may also install global packages in your CodeBuild environment, such as Angular CLI. So, the place of your CodeArtifact login command depends on your buildspec file’s structure.&lt;/p&gt;

&lt;p&gt;In my sample buildspec below, I install Angular CLI in the install phase and the project dependencies in the pre_build phase. Then, I build the Angular project in the build phase.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.2&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;phases&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runtime-versions&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;nodejs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; 
      &lt;span class=&quot;c1&quot;&gt;# Install the Angular CLI&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install -g @angular/cli@17&lt;/span&gt;

  &lt;span class=&quot;na&quot;&gt;pre_build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Install the project dependencies&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install&lt;/span&gt;

  &lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Build the Angular application&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ng build -c production&lt;/span&gt;
      
&lt;span class=&quot;na&quot;&gt;artifacts&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;base-directory&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dist/my-angular-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;**/*&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If I place the CodeArtifact in the pre_build phase, the npm install command for Angular CLI in the install phase will still fetch the package from the central npm registry. But I also want CodeBuild to fetch it from CodeArtifact. So, either I would move the Angular CLI installation to the pre_build phase or place the CodeArtifact login before it.&lt;/p&gt;

&lt;p&gt;I chose the second option. You can see the final buildspec file below.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.2&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;phases&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runtime-versions&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;nodejs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Log in to CodeArtifact&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;echo &apos;Logging in to CodeArtifact...&apos;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;aws codeartifact login --tool npm --repository ${CODEARTIFACT_REPO} --domain ${CODEARTIFACT_DOMAIN} --domain-owner ${CODEARTIFACT_OWNER}&lt;/span&gt;
      
      &lt;span class=&quot;c1&quot;&gt;# Install the Angular CLI&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install -g @angular/cli@17&lt;/span&gt;

  &lt;span class=&quot;na&quot;&gt;pre_build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Install the project dependencies&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;npm install&lt;/span&gt;

  &lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;commands&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Build the Angular application&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ng build -c production&lt;/span&gt;
      
&lt;span class=&quot;na&quot;&gt;artifacts&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;base-directory&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;dist/my-angular-project&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;**/*&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Because the build execution logs in to CodeArtifact before all npm install commands, all required Node packages will be stored in the CodeArtifact domain first. Then, they will be installed from CodeArtifact into the CodeBuild environment.&lt;/p&gt;

&lt;p&gt;If you joined my &lt;a href=&quot;https://www.udemy.com/course/aws-codepipeline-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CodePipeline Step by Step&lt;/a&gt; course, you are already familiar with the ‘aws ecr get-login’ command. The ‘codeartifact login’ command works similarly. It returns an authentication token to be used by the Node package manager (npm) in the HTTP Authorization header while logging in to CodeArtifact.&lt;/p&gt;

&lt;h2 id=&quot;the-result-of-the-build&quot;&gt;The Result of the Build&lt;/h2&gt;

&lt;p&gt;After executing the build project, you will have these in your logs and CodeArtifact repositories.&lt;/p&gt;

&lt;h3 id=&quot;the-codebuild-logs&quot;&gt;The CodeBuild logs&lt;/h3&gt;

&lt;p&gt;After running the build, you will see a build log for the successful login similar to the one below. Please note the build log after the CodeArtifact login command.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-login-codebuild-logs.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-login-codebuild-logs.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-login-codebuild-logs.jpg&quot; alt=&quot;CodeArtifact login in the CodeBuild build logs&quot; width=&quot;1280&quot; height=&quot;343&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;The authorization token returned by the ‘codeartifact login’ command provided 12 hours of access, which was much more than needed for my CodeBuild project execution.&lt;/p&gt;

&lt;h3 id=&quot;the-codeartifact-repositories-after-the-build&quot;&gt;The CodeArtifact repositories after the build&lt;/h3&gt;

&lt;p&gt;After the build, you will see your CodeArtifact repository with new package versions.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-demo-repository-after-build.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-demo-repository-after-build.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-demo-repository-after-build.jpg&quot; alt=&quot;The AWS CodeArtifact repository after the build with AWS CodeBuild&quot; width=&quot;1280&quot; height=&quot;767&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Actually, these are from the upstream npm-store repository in your CodeArtifact domain.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-npm-store-after-build.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-npm-store-after-build.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-08-codeartifact/codeartifact-npm-store-after-build.jpg&quot; alt=&quot;npm-store repository on AWS CodeArtifact after the build with AWS CodeBuild&quot; width=&quot;1280&quot; height=&quot;763&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;CodeArtifact automatically fetches all dependencies from your package.json file in your Node or Angular project. But if your project continues to use the same package versions, CodeArtifact will not fetch those unless you delete them. If your project references a new version, CodeArtifact will fetch it in the subsequent build execution.&lt;/p&gt;

&lt;h2 id=&quot;would-you-like-to-learn-to-use-aws-codebuild-with-aws-codepipeline&quot;&gt;Would you like to learn to use AWS CodeBuild with AWS CodePipeline?&lt;/h2&gt;

&lt;p&gt;If you want to learn to use AWS CodeBuild in your CI/CD pipelines, my &lt;a href=&quot;https://www.udemy.com/course/aws-codepipeline-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CodePipeline Step by Step&lt;/a&gt; course on Udemy may be helpful.&lt;/p&gt;

&lt;p&gt;In this course, you will learn to use AWS CodePipeline to build CI/CD pipelines on AWS step by step to build your applications with CodeBuild and deploy them to S3 or EC2. You will also learn to create Docker images with CodeBuild and deploy Docker containers from them to Amazon ECS with CodePipeline. We cover many CodeBuild features in detail in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Udemy bestseller&lt;/code&gt; course.&lt;/p&gt;

&lt;p&gt;The links in this post also provides a special discount for you. You can view all my courses on &lt;a href=&quot;https://courses.shikisoft.com&quot;&gt;our Courses page&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;AWS CodeArtifact provides a feasible and efficient central package management solution for your software development processes. In this post, I provided an example of using AWS CodeArtifact with your CodeBuild projects.&lt;/p&gt;

&lt;p&gt;If you found it helpful, please also share it on your LinkedIn profile or X (Twitter) account to help me reach others like you.&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href=&quot;https://www.linkedin.com/in/emre-yilmaz-shikisoft/&quot;&gt;LinkedIn&lt;/a&gt; and &lt;a href=&quot;https://x.com/emrey_shikisoft&quot;&gt;X (Twitter)&lt;/a&gt; to hear about my future online courses or blog posts.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/codeartifact/latest/ug/codeartifact-concepts.html&quot;&gt;AWS CodeArtifact Concepts - AWS CodeArtifact Docs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/codeartifact/latest/ug/using-npm-packages-in-codebuild.html&quot;&gt;Using npm packages in CodeBuild - AWS CodeArtifact Docs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.phases&quot;&gt;Phases - AWS CodeBuild Buildspec Reference&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://aws.amazon.com/codeartifact/pricing/&quot;&gt;AWS CodeArtifact Pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/aws-codeartifact-with-codebuild-post.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-08-codeartifact/aws-codeartifact-with-codebuild-post.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2024-08-codeartifact/aws-codeartifact-with-codebuild-post.jpg&quot; alt=&quot;Using AWS CodeArtifact with CodeBuild: An Angular Build Example&quot; width=&quot;1200&quot; height=&quot;675&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="AWS CodeArtifact" /><category term="AWS CodeBuild" /><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2024-08-codeartifact/aws-codeartifact-with-codebuild-post.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2024-08-codeartifact/aws-codeartifact-with-codebuild-post.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">A Quick Overview of IAM Permission Policies: AWS-Managed, Customer-Managed, and Inline Policies</title><link href="https://blog.shikisoft.com/aws-iam-permission-policies-overview/" rel="alternate" type="text/html" title="A Quick Overview of IAM Permission Policies: AWS-Managed, Customer-Managed, and Inline Policies" /><published>2024-07-25T00:00:00+00:00</published><updated>2024-07-25T00:00:00+00:00</updated><id>https://blog.shikisoft.com/aws-iam-permission-policies-overview</id><content type="html" xml:base="https://blog.shikisoft.com/aws-iam-permission-policies-overview/">&lt;p&gt;In AWS IAM, permission policies play a crucial role in securely controlling access to your AWS environment. You can attach three types of permission policies to your identities: AWS-managed, customer-managed, and inline policies. 
In most cases, AWS recommends using managed policies over inline policies, especially customer-managed policies created from AWS-managed policies. However, there may also be cases for inline policies. In this post, we will quickly explore IAM’s permission policies to help you decide which is best for you.&lt;/p&gt;

&lt;p&gt;By the way, we will only talk about AWS IAM’s identity-based permission policies in this post. The resource-based trust policies used in IAM roles, in which you specify the principals you trust to assume a role, will be out of the scope of this post. So, when we use the ‘policy’ term below, it will only refer to an IAM permission policy: AWS-managed, customer-managed, or inline. Then, let’s begin.&lt;/p&gt;

&lt;p&gt;So, when you attach a policy to an identity (a user, group of users, and a role), that policy determines whether to allow or deny access to your AWS resources. Hence, with security threats in mind, choosing the right policy type for your needs is essential, as well as granting the least privilege. But you wouldn’t want to increase the management overhead while doing this, right?&lt;/p&gt;

&lt;p&gt;Each IAM policy type has its use cases. So, let’s analyze each one to see what features it offers.
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-do-aws-managed-policies-offer&quot;&gt;What do AWS-managed policies offer?&lt;/h2&gt;

&lt;p&gt;The AWS-managed policy is a standalone policy that exists independently from an identity. That means each AWS-managed policy has its own Amazon Resource Name (ARN). The main advantage of AWS-managed policies is that &lt;strong&gt;AWS undertakes the whole process of creating and managing AWS-managed policies.&lt;/strong&gt; So, you don’t need to bother yourself with writing and maintaining them.&lt;/p&gt;

&lt;p&gt;Also, AWS updates the policies when required to add new features. Then, all the identities to whom an AWS-managed policy is attached automatically get the updated policy permissions.&lt;/p&gt;

&lt;p&gt;Attaching an AWS-managed policy to an identity is straightforward.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Firstly, from the IAM console, you go to the profile page of the identity (user, user group, or role).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;For IAM roles and groups, click the ‘Add permissions’ section on the ‘Permissions’ tab and choose the ‘Attach policies’ option from the dropdown.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;For IAM users, you click the ‘Add permissions’ menu and choose ‘Add permissions’ again. Then, you select the ‘Attach policies directly’ option.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;After that, you can see all AWS-managed policies available to choose from. You can filter them using the search box. The interface may be slightly different, but you can see an example of AWS-managed policies filtered for ‘cloudwatch’ below.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-managed-cloudwatch-policies.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-managed-cloudwatch-policies.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-07-iam-policies/aws-managed-cloudwatch-policies.jpg&quot; alt=&quot;Filtered AWS-managed policies example&quot; width=&quot;1800&quot; height=&quot;809&quot; /&gt;
    
&lt;/picture&gt;

&lt;ul&gt;
  &lt;li&gt;You can choose the ones that fit your requirements and attach them to your IAM identity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Currently, there are over a thousand AWS-managed policies. Please remember that AWS-managed policies can be used for more than one identity in one account or across multiple accounts.&lt;/p&gt;

&lt;h3 id=&quot;do-aws-managed-policies-work-in-all-cases&quot;&gt;Do AWS-managed policies work in all cases?&lt;/h3&gt;

&lt;p&gt;Besides the advantages, &lt;strong&gt;using ready-made AWS-managed policies may sometimes be unfavorable because you cannot change their permissions yourself&lt;/strong&gt;. Your requirements may differ, or you may need to grant specific permissions to your identities other than those described in the AWS-managed policies.&lt;/p&gt;

&lt;p&gt;Besides, AWS creates policies for general use cases and scenarios. Therefore, &lt;strong&gt;they could cover more permissions than the ones you intend for your identities&lt;/strong&gt;. You may also need to limit your permissions for specific resources in your AWS account.&lt;/p&gt;

&lt;p&gt;In those cases and many more not covered here, using an AWS-managed policy would be against AWS security best practices for granting the least privilege, which means giving the minimum permissions necessary to your identities. As a solution, you can create customer-managed policies by setting permissions aligning with your needs.&lt;/p&gt;

&lt;h2 id=&quot;tailored-for-your-needs-customer-managed-iam-policies&quot;&gt;Tailored for your needs: Customer-managed IAM policies&lt;/h2&gt;

&lt;p&gt;Like AWS-managed policies, customer-managed IAM policies are standalone policies that can be attached to multiple identities. You can easily create and manage policies yourself.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;To do this, you go to the IAM console in your AWS account.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;On the left-hand side, select the ‘Policies’ section under ‘Access Management’ and then click the ‘Create policy’ button to create one.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;On the Create policy page, you will see two policy editor options: one is a ‘Visual’ editor, and the other is ‘JSON.’ JSON editor is the preferred option in most cases. However, you can create a policy from scratch with the Visual editor if you don’t know the JSON syntax.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;In the JSON editor, you can either type a new policy or paste an existing policy and then customize it. Usually, AWS recommends copying an existing AWS-managed policy and modifying it according to your requirements.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A typical JSON policy looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2012-10-17&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Statement&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
		&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
			&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Sid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Statement1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
			&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Effect&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Allow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
			&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Action&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
			&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Resource&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      		&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Condition&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

      		&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
		&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
	&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Your JSON policy can contain multiple statements defined under the ‘Statement’ array, which specifies a set of permissions to be allowed or denied. A statement consists of these sections:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Sid:&lt;/strong&gt; A unique statement ID.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Effect:&lt;/strong&gt; ‘Allow’ or ‘Deny’&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt; The actions that will be allowed or denied.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Resource:&lt;/strong&gt; The resources that the policy will cover.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Condition:&lt;/strong&gt; Optional section for setting conditions to filter the resources to create a more granular policy. For example, you can add a ‘StringEquals’ condition to filter the resources based on a tag value.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can attach your customer-managed policies like you would an AWS-managed policy. When the managed policies are listed, you can use the search field to find your policy or list only customer-managed policies using the type filter.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policy-type-filter.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policy-type-filter.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policy-type-filter.jpg&quot; alt=&quot;Filtering IAM policies by type to list only customer-managed policies&quot; width=&quot;1964&quot; height=&quot;700&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Like AWS-managed policies, when you update permissions in a policy, the changes apply to all identities to whom the policy is attached. So, it brings reusability advantages over inline policies, as you will see below.&lt;/p&gt;

&lt;p&gt;Having said that, &lt;strong&gt;customer-managed policies have many advantages over other types&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Compared to AWS-managed policies, you can make any update or change you want without waiting for AWS to do so.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Besides, unlike AWS-managed policies, you can customize your customer-managed policies to cover only specific resources.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Most importantly, customer-managed policies bring &lt;strong&gt;versioning and rollback features&lt;/strong&gt;. When you update a customer-managed policy, IAM saves it as a new version by keeping up to five versions. So, if you encounter a problem after an update, you can quickly roll back to a previous version of your customer-managed policy.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-about-inline-iam-policies&quot;&gt;What about inline IAM policies?&lt;/h2&gt;

&lt;p&gt;You also have a third policy option to use: inline policies. In most cases, inline policies are not favored much as they offer limited features compared to managed policies. &lt;strong&gt;Inline policies are directly embedded into a user, user group, or role, and becomes an inherent part of the identity.&lt;/strong&gt; Therefore, when the identity is deleted, its inline policies are also destroyed.&lt;/p&gt;

&lt;p&gt;So, there is a stricter relationship between the inline policy and the identity compared to managed policies. This usually makes using inline policies inefficient. When you want to change permissions in an inline policy, you must do this from the identity profile. If you have more than one identity containing the same inline policy, &lt;strong&gt;repeating the same process for each one becomes tiresome and prone to errors&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;On the other hand, this direct, one-to-one relationship between the identity and the policy can be favorable in certain situations. Suppose you need to ensure that a policy’s permissions are not granted to a wrong identity in any way. In that case, &lt;strong&gt;you can use an inline policy to prevent inadvertently granting permissions to identities other than that you assign for&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each IAM policy is a JSON file with a character limit, and &lt;strong&gt;the maximum character limit for an inline policy is smaller than that for managed policies&lt;/strong&gt;. If you reach the maximum character limit in an inline policy, you will need to divide it into multiple inline policies or convert it to a customer-managed policy.&lt;/p&gt;

&lt;p&gt;Let’s briefly talk about creating an inline policy as well.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;To create an inline policy, first go to your user’s, user group’s, or role’s page on the IAM Console and switch to the ‘Permissions’ tab.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;This time, you should select ‘Create inline policy’ from the ‘Add permissions’ menu.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Then, you will see Visual or JSON policy editors again, as in the customer-managed policies. You can add your permissions, which should apply to the relevant identity there.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;3-key-differences-to-note-between-iam-policy-types&quot;&gt;3 key differences to note between IAM policy types&lt;/h2&gt;

&lt;p&gt;As discussed above, specific use cases exist for managed and inline policies. Before deciding which one to choose, we recommend you evaluate them individually according to your use case. But to make it easier for you, let’s recap the primary differences that would affect your decision.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Firstly, &lt;strong&gt;an inline policy can only apply to a specific identity&lt;/strong&gt;. Meanwhile, managed policies, either AWS-managed or customer-managed, can be attached to multiple identities. So, if you consider assigning a policy to various identities, using managed policies would be the feasible option. Also, you can convert an inline policy to a managed policy later if you change your mind.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Another significant difference is about policy updates&lt;/strong&gt;. AWS already updates policies as needed for AWS-managed policies. Also, you can easily update a customer-managed policy by adding or removing permissions yourself. After these updates, relevant changes will apply to all identities to which the policies are attached. On the other hand, if you define the same inline policy in multiple identities, you must edit the policy in each identity one by one to add or remove permissions, which would be an efficiency problem.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Customer-managed policies bring versioning and rollback capabilities to your policies&lt;/strong&gt;. When customer-managed policies, you can quickly roll back to a previous version, which can be the sole reason to choose them over others.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Managed policies allow more characters compared to inline policies&lt;/strong&gt;. So, at some point, you may have to divide your inline policies into multiple or convert them to customer-managed policies to provide more permissions.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;AWS-managed policies, customer-managed policies, and inline policies are three IAM policy types suitable for different use cases. Whichever you choose, granting the least privilege access to your resources while managing them efficiently is crucial for securing your AWS environment.&lt;/p&gt;

&lt;p&gt;In this post, we provided an overview of AWS policy types. We hope this will be helpful when assigning permissions to your IAM identities in your projects.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html&quot;&gt; Access management for AWS resources &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html&quot;&gt; Controlling access to AWS resources using tags &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policies-overview.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policies-overview.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/2024-07-iam-policies/aws-iam-policies-overview.jpg&quot; alt=&quot;An overview of AWS IAM policies&quot; width=&quot;1280&quot; height=&quot;720&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="AWS IAM" /><summary type="html">In AWS IAM, permission policies play a crucial role in securely controlling access to your AWS environment. You can attach three types of permission policies to your identities: AWS-managed, customer-managed, and inline policies. In most cases, AWS recommends using managed policies over inline policies, especially customer-managed policies created from AWS-managed policies. However, there may also be cases for inline policies. In this post, we will quickly explore IAM’s permission policies to help you decide which is best for you.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/2024-07-iam-policies/aws-iam-policies-overview.webp" /><media:content medium="image" url="https://blog.shikisoft.com/2024-07-iam-policies/aws-iam-policies-overview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">5 Things to Note About AWS Free Tier</title><link href="https://blog.shikisoft.com/notes-for-aws-free-tier/" rel="alternate" type="text/html" title="5 Things to Note About AWS Free Tier" /><published>2024-05-13T00:00:00+00:00</published><updated>2024-05-13T00:00:00+00:00</updated><id>https://blog.shikisoft.com/notes-for-aws-free-tier</id><content type="html" xml:base="https://blog.shikisoft.com/notes-for-aws-free-tier/">&lt;p&gt;When I first used AWS back in 2013, I remember missing some free-tier benefits in my first year. I was developing an app with Ruby on Rails and read some fancy blog posts about how another VPS provider performs better than AWS, and I didn’t use EC2 or RDS at the start. I had to manage my servers and MariaDB databases myself. Even though that Linux administration experience helped me become a DevOps engineer today and better understand AWS’s benefits, my life would have been easier then, even with fewer costs. So, the AWS free tier is a great offer, especially when starting to learn the cloud and AWS.&lt;/p&gt;

&lt;p&gt;However, if you are new to AWS, understanding the exact coverage of the AWS free tier can be confusing. Besides, you may be concerned about encountering a surprise bill at the beginning of the following month. So, in this post, let’s discuss five of the most crucial things you need to know about the AWS free tier and how to avoid unexpected costs when benefiting from it.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2 id=&quot;1---be-sure-to-understand-what-is-offered-under-aws-free-tier&quot;&gt;1 - Be sure to understand what is offered under AWS free tier!&lt;/h2&gt;

&lt;p&gt;First, you should note that &lt;strong&gt;most AWS free-tier services have specific usage limits or expirations&lt;/strong&gt;. AWS offers three types of free-tier offers: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;always free&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;12 months free&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;short-term trials&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Always free&lt;/code&gt; offers have no expiration, as their name suggests. However, they mostly have usage limits limit allocated for each month.&lt;/strong&gt; For instance, although you see AWS Lambda with an ‘Always free’ offer on the AWS Free Tier page, at the time of this post, you can only get up to 1 million free requests and 3.2 million seconds of free compute time per month. So, if you exceed this limit, you pay for what you use for the exceeding part.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;You can use some services 12 months free right after you sign up for AWS.&lt;/strong&gt; After one year, this offer expires, and you will start paying standard fees for your usage. The ‘12 months free’ offer for the eligible AWS resources come &lt;strong&gt;with certain usage limits&lt;/strong&gt;. For instance, Amazon S3 is one of the most popular AWS services that provides free usage for 12 months with a limited 50 GB of standard storage, 20,000 get requests, and 2,000 put requests per month.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Short-term trials enable you to try out an AWS product for a given time with a specific limit.&lt;/strong&gt; For example, Amazon Redshift is a popular AWS data-warehousing service offering a free trial. You can use Amazon Redshift free for two months, valid for only 750 ‘DC2.Large’ node hours per month, and you will be charged after that. Whereas, you can use AWS Security Hub unlimited for 30 days.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although they are not the goal of this post and their number is small, AWS offers some services ‘always free’ and unlimited. For example, in the Individual Tier, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS CodeWhisperer&lt;/code&gt; provides unlimited code suggestions for your Java, Python, or other supported code. You can also use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AWS Well-Architected Tool&lt;/code&gt; for free to review your AWS architecture according to best practices.&lt;/p&gt;

&lt;p&gt;Of course, the free tier examples given in this post are subject to change. To find the AWS service that best matches your needs, I recommend you navigate through &lt;a href=&quot;https://aws.amazon.com/free&quot;&gt;the AWS free tier page&lt;/a&gt;. On this page, please carefully analyze which services are free and under which conditions. So that you avoid any surprises later and plan your budget accordingly.&lt;/p&gt;

&lt;h2 id=&quot;2---configure-your-settings-carefully-to-stay-in-the-free-tier&quot;&gt;2 - Configure your settings carefully to stay in the free tier!&lt;/h2&gt;

&lt;p&gt;When you launch an AWS resource with an AWS free tier offer, you must configure your settings carefully in your AWS account &lt;strong&gt;to ensure the services you select are all free tier eligible.&lt;/strong&gt; For example, in the AWS EC2 instances free trial offer, only the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t2.micro&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t3.micro&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t4g.micro&lt;/code&gt; instance classes are free for up to 750 hours. So, if you accidentally select an instance type different than these, the free tier won’t cover your usage and you will still be charged for it.&lt;/p&gt;

&lt;p&gt;Also, not very likely, but AWS’s default settings may sometimes be misleading. For example, while launching an EC2 instance from the EC2 Console, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t2.xlarge&lt;/code&gt; instance type may be selected by default. If you proceed without noticing, you must pay for it. So, please check the default settings before launching an AWS resource and ensure all selected configuration fall under the AWS free tier.&lt;/p&gt;

&lt;h2 id=&quot;3---use-your-free-limits-wisely&quot;&gt;3 - Use your free limits wisely!&lt;/h2&gt;

&lt;p&gt;AWS free tier is calculated and renewed &lt;strong&gt;monthly across all regions, not per region.&lt;/strong&gt; That means when you choose a free tier service, you will be granted free limits to use in all regions, not in each region. &lt;strong&gt;Besides, your unused limits do not roll over to the next month.&lt;/strong&gt; So, I recommend you use your free limits as efficiently as possible.&lt;/p&gt;

&lt;p&gt;Also, please be sure to turn off or delete the services you don’t use to avoid unexpected charges. If you forget, these services will still run in the background, and when they expire or exceed the free threshold, you will be charged. It would be frustrating to pay for something you did not use.&lt;/p&gt;

&lt;h2 id=&quot;4---review-your-free-tier-usage-once-in-a-while&quot;&gt;4 - Review your free tier usage once in a while!&lt;/h2&gt;

&lt;p&gt;Checking your AWS Billing Console regularly will help you get an overview of your AWS costs. In your AWS account, you can see your usage activity over time in the AWS Billing Dashboard. This includes active services, cost trends, monthly forecasts, etc.&lt;/p&gt;

&lt;p&gt;To find a more detailed breakdown of your services with more granular cost and usage data, you can view &lt;a href=&quot;https://docs.aws.amazon.com/cost-management/latest/userguide/ce-what-is.html&quot;&gt;AWS Cost Explorer&lt;/a&gt;. It provides a graph view, showing your total monthly costs, which can be grouped according to service, region, resource, etc. This allows you to take action on your costs if you see any overused service.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://calculator.aws/&quot;&gt;AWS Pricing Calculator&lt;/a&gt; is another free tool to check if your planned usage is under the free tier thresholds. Let’s say you want to use AWS Lambda. When you create an estimate and enter the details, such as the number of requests you need and memory requirements in the AWS Pricing Calculator, your estimated calculation will be shown to you. Therefore, you can see whether or how much you will need to pay for your AWS Lambda usage.&lt;/p&gt;

&lt;h2 id=&quot;5---get-notified-if-your-usage-exceeds-aws-free-tier&quot;&gt;5 - Get notified if your usage exceeds AWS Free Tier!&lt;/h2&gt;

&lt;p&gt;Most AWS users automatically opt-in to receive emails when they exceed 85% of the free tier limits. So, if you exceed 85% of your AWS free tier limits, by default, AWS will send alerts to the email address you used to create your AWS account. However, please ensure that the option to receive free tier usage alerts is enabled from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Billing Preferences&lt;/code&gt; page on the AWS Management Console. If you use &lt;a href=&quot;https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html&quot;&gt;AWS Organizations&lt;/a&gt; and own a management account with consolidated billing, you must also opt-in to receive these alerts from the ‘Billing Preferences’ section in the management account.&lt;/p&gt;

&lt;p&gt;These alerts are sent for each free tier service active in the current month. So, I recommend you not ignore or mark them as spam since they are crucial reminders of your usage.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-billing-alert-preferences.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-billing-alert-preferences.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/20240513-aws-free-tier/aws-billing-alert-preferences.jpg&quot; alt=&quot;Enabling AWS free tier alerts from the Billing Preferences.&quot; width=&quot;1518&quot; height=&quot;896&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;Besides, you can set custom alerts through AWS Budgets to let you know when you exceed or are forecasted to exceed free tier usage limits. By setting a ‘zero spend budget’ template, you can track your usage up to 100%. This will help you stay within your budget and manage your free tier usage.&lt;/p&gt;

&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-budgets-zero-spend-budget-template.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-budgets-zero-spend-budget-template.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/20240513-aws-free-tier/aws-budgets-zero-spend-budget-template.jpg&quot; alt=&quot;Creating a budget on AWS Budgets using the zero spend budget template.&quot; width=&quot;1428&quot; height=&quot;928&quot; /&gt;
    
&lt;/picture&gt;

&lt;p&gt;AWS also offers &lt;a href=&quot;https://aws.amazon.com/aws-cost-management/aws-cost-anomaly-detection/&quot;&gt;Cost Anomaly Detection&lt;/a&gt; as a free tool to alert you on abnormal costs in your AWS account. When creating a subscription for the AWS Cost Anomaly Detection, you must set a threshold above which an anomaly alert is sent. You can configure other details like alerting frequency or alert recipients on the same page.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;AWS free tier can help you gain hands-on experience on AWS. However, if you are unsure what it covers, you may encounter surprising charges at the end. In this post, I tried to share with you how you can utilize AWS free tier services as ‘free’ as possible and how you can track your free AWS usage. I hope it will be helpful for you.&lt;/p&gt;

&lt;p&gt;In &lt;a href=&quot;https://courses.shikisoft.com&quot;&gt;our online courses&lt;/a&gt;, we try to use resources covered by the AWS free tier as much as possible to avoid unexpected costs. So, you can do most hands-on examples for free by just opening a new AWS account. Of course, if the topic requires larger resources beyond the limits offered, we sometimes use them for a brief time. But these cases are rare, and you are warned about their costs during the lectures.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and see you in my next post!&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://aws.amazon.com/free/&quot;&gt;AWS Free Tier&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://calculator.aws/&quot;&gt;AWS Pricing Calculator&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/cost-management/latest/userguide/ce-what-is.html&quot;&gt;Analyzing your costs with AWS Cost Explorer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-free-tier-post-hero.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/20240513-aws-free-tier/aws-free-tier-post-hero.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/20240513-aws-free-tier/aws-free-tier-post-hero.jpg&quot; alt=&quot;5 Things to Note About AWS Free Tier&quot; width=&quot;1280&quot; height=&quot;960&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/20240513-aws-free-tier/aws-free-tier-post-hero.webp" /><media:content medium="image" url="https://blog.shikisoft.com/20240513-aws-free-tier/aws-free-tier-post-hero.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Importing AWS Resources to CDK Apps with Python</title><link href="https://blog.shikisoft.com/aws-cdk-import-resources-python/" rel="alternate" type="text/html" title="Importing AWS Resources to CDK Apps with Python" /><published>2024-04-24T00:00:00+00:00</published><updated>2024-04-24T00:00:00+00:00</updated><id>https://blog.shikisoft.com/aws-cdk-import-resources-python</id><content type="html" xml:base="https://blog.shikisoft.com/aws-cdk-import-resources-python/">&lt;p&gt;In my &lt;a href=&quot;https://www.udemy.com/course/aws-cdk-with-python-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CDK with Python Step by Step&lt;/a&gt; course, I teach you to define your constructs from the ground up. You learn to specify your AWS resources through CDK constructs using Python’s object-oriented methods.&lt;/p&gt;

&lt;p&gt;However, what if you need to use or reference an existing resource from your AWS account, such as a VPC? Can you import a resource to your AWS CDK app?&lt;/p&gt;

&lt;p&gt;So, in this blog post, I will discuss how to import an existing resource as a CDK construct. But you cannot achieve this in environment-agnostic stacks. Hence, we will start with specifying targetted CDK environments for your CDK stacks.
&lt;!--break--&gt;&lt;/p&gt;

&lt;h2 id=&quot;how-does-resource-importing-work-on-aws-cdk&quot;&gt;How does resource importing work on AWS CDK?&lt;/h2&gt;

&lt;p&gt;Before implementing, let’s first understand how CDK imports an existing resource from your AWS account.&lt;/p&gt;

&lt;p&gt;In a CDK app, you specify all resources as &lt;a href=&quot;/aws-cdk-construct-levels/&quot;&gt;L1, L2, or L3 constructs&lt;/a&gt; in your CDK stacks. Then, when you use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdk synth&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdk deploy&lt;/code&gt; commands, the CDK Toolkit synthesizes a CloudFormation template from your code for each CDK stack. So, the templates are usable for all the target CDK environments you deploy.&lt;/p&gt;

&lt;p&gt;However, the process is somewhat different if a resource needs to be imported to your CDK stack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; You again declare the existing AWS resource you want to import as a CDK construct using a special &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from&lt;/code&gt; method provided by its L2-level CDK construct. You need to give the resource ID, ARN, or another field to search for the resource. After that, you can reference it in other constructs, like a regular L2-level construct of its type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; When you execute the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdk synth&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdk deploy&lt;/code&gt; commands, CDK uses the AWS SDK for your programming language to search for the resource in your target CDK environment and synthesizes the template with that resource’s referenced values if the search is successful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; CDK deploys the stack to your target CDK environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You cannot modify an AWS resource imported to your CDK environment as a CDK construct.&lt;/strong&gt; You can only use it in read-only mode. You reference it as a CDK construct while configuring other constructs to benefit from CDK’s object-oriented methods.&lt;/p&gt;

&lt;p&gt;This also won’t work in an environment-agnostic CDK stack because the CDK Toolkit must know the target CDK environment before looking for the resource. It gets them from your CDK app. Therefore, let’s continue with discussing CDK environments and how you specify the target CDK environments for your stacks.&lt;/p&gt;

&lt;h2 id=&quot;what-is-a-cdk-environment&quot;&gt;What is a CDK environment?&lt;/h2&gt;

&lt;p&gt;A CDK environment is where you deploy your CDK stack. CDK stacks correspond to CloudFormation stacks during deployment. So, they are regional resources. &lt;strong&gt;Hence, a CDK environment is your deployment target consisting of an AWS account and a region.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you initialize a CDK app, it sets up an environment-agnostic stack by default. In other words, it initalizes a CDK stack with no CDK environment setting. For environment-agnostic stacks, the CDK Toolkit deploys the synthesized CloudFormation templates to the CDK environment of your current AWS CLI profile.&lt;/p&gt;

&lt;p&gt;By the way, a CDK environment doesn’t exist only in theory. &lt;strong&gt;You must physically bootstrap your CDK environment before executing any CDK deployments to prepare the environment beforehand.&lt;/strong&gt; You do this using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cdk bootstrap&lt;/code&gt; command, which deploys a CloudFormation stack in the target AWS account and region for the necessary resources used by the CDK Toolkit. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bootstrap&lt;/code&gt; command uses a template provided by the CDK team. So, you don’t need to do anything other than execute the command to bootstrap your CDK environment.&lt;/p&gt;

&lt;p&gt;However, bootstrapping an environment is not sufficient to import an existing resource to your CDK app. You must also set the CDK environment of your stack in your app code to inform the CDK Toolkit about the target environment for the search. &lt;strong&gt;Importing doesn’t work in environment-agnostic stacks.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are a few differences between environment-agnostic stacks and stacks with specified environments, including this resource importing feature. We can discuss them in more detail later in another blog post. But for now, let’s continue with setting your stack’s CDK environment.&lt;/p&gt;

&lt;h2 id=&quot;how-do-you-set-your-cdk-stacks-target-environment&quot;&gt;How do you set your CDK stack’s target environment?&lt;/h2&gt;

&lt;p&gt;When you initialize a CDK app, you will see a comment in the stack definition in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app.py&lt;/code&gt; file, which explains the initialization of an environment-agnostic stack by default. As also described in this comment, there are two ways to set the target environment of your CDK stack.&lt;/p&gt;

&lt;h3 id=&quot;method-1-specifying-aws-account-id-and-region-code&quot;&gt;Method 1: Specifying AWS account ID and region code&lt;/h3&gt;

&lt;p&gt;The first option is hardcoding your AWS account ID and region, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;app.py file&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;account&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;444433332222&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                                &lt;span class=&quot;n&quot;&gt;region&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;eu-central-1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here, &lt;em&gt;444433332222&lt;/em&gt; is the hypothetical number for my AWS account ID, and &lt;em&gt;eu-central-1&lt;/em&gt; is the code of the AWS Frankfurt region. Please replace them with your own AWS account number and region.&lt;/p&gt;

&lt;p&gt;Of course, a CDK environment must be bootstrapped in this AWS account for this region. You must also have permission to create CloudFormation stacks and resources specified in the target environment.&lt;/p&gt;

&lt;p&gt;This hardcoded setting always tries to deploy your CDK stack to the same AWS account and region, regardless of your AWS CLI configuration. In this way, you lose the reusability of your CDK code for other AWS accounts and regions. However, by hardcoding its environment as a target, &lt;strong&gt;you ensure that the imported resource exists&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;However, there is another method that enables you to deploy your app in other environments, too, without making your stack environment-agnostic. I never liked hardcoding values in my code, so let’s also discuss the second method as an alternative.&lt;/p&gt;

&lt;h3 id=&quot;method-2-using-the-current-aws-cli-profile-settings&quot;&gt;Method 2: Using the current AWS CLI profile settings&lt;/h3&gt;

&lt;p&gt;You can use the environment variables set for your AWS CLI profile while configuring the environment of your CDK stack. So, for the same stack, the example becomes like below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;app.py file&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;nc&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cdk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;account&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getenv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;CDK_DEFAULT_ACCOUNT&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; 
                                &lt;span class=&quot;n&quot;&gt;region&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getenv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;CDK_DEFAULT_REGION&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here, you reference the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CDK_DEFAULT_ACCOUNT&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CDK_DEFAULT_REGION&lt;/code&gt; environment variables using Python’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;os&lt;/code&gt; library. These are implied environment variables that the CDK Toolkit sets in reference to the values of your current AWS CLI profile. Before performing the lookup method to search for the AWS resource, the CDK Toolkit will replace them with the values from your AWS CLI profile configuration. So, the search will be performed on the target environment.&lt;/p&gt;

&lt;p&gt;OK, you also set the environment of your CDK stack. Now is the time to discuss importing an existing resource in your CDK app.&lt;/p&gt;

&lt;h2 id=&quot;the-from_xxx-methods-provided-by-cdk-constructs&quot;&gt;The from_xxx() methods provided by CDK constructs&lt;/h2&gt;

&lt;p&gt;L2-level CDK constructs are the first-class citizen CDK constructs that provide many object-oriented features, making up most of the CDK’s advantages over JSON or YAML CloudFormation templates. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_xxx()&lt;/code&gt; methods are among those (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xxx&lt;/code&gt; changes according to the resource type), which enable you to import existing AWS resources as L2-level CDK constructs from your target environment by searching for their specific features.&lt;/p&gt;

&lt;p&gt;You can’t use an imported CDK construct to modify the underlying resource. However, you can use its construct object like regular objects of that resource type to configure other resources.&lt;/p&gt;

&lt;p&gt;Now, let’s provide an example by importing an existing VPC to our CDK app to launch an EC2 instance in it.&lt;/p&gt;

&lt;h2 id=&quot;example-importing-a-vpc-to-your-cdk-stack&quot;&gt;Example: Importing a VPC to your CDK stack&lt;/h2&gt;

&lt;p&gt;Suppose you have a preconfigured VPC in your AWS account. Instead of creating a new one, you want to create your CDK app’s resources in this VPC. You may have other resources managed by other CDK apps and may not want to configure a separate VPC for each app. Whatever your reason, you can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ec2.Vpc&lt;/code&gt; construct’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_lookup()&lt;/code&gt; method to import your VPC as below.&lt;/p&gt;

&lt;p&gt;CDK constructs correspond to one or more AWS resources. You define them in your CDK stacks. Below is an example of importing an existing VPC in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; method of a sample CDK stack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sample_app.sample_stack.py&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Construct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;construct_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;construct_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;n&quot;&gt;my_vpc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Vpc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;from_lookup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;MyVpc&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpc_id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;vpc-0f1a1122223333456&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here, we provided the ID of the VPC we want to import to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpc_id&lt;/code&gt; attribute. So, the CDK Toolkit will perform the lookup by searching for a VPC with this VPC ID in the target CDK environment of the stack and proceed with the synthesis afterward.&lt;/p&gt;

&lt;p&gt;Instead of the VPC ID, you can filter the VPCs according to a tag value via the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tags&lt;/code&gt; attribute or use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpc_name&lt;/code&gt; to filter according to its name.&lt;/p&gt;

&lt;p&gt;VPC construct also provides the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_vpc_attributes&lt;/code&gt; method if you need to search for a VPC by providing more attributes, such as isolated subnet IDs, availability zones, etc. But if you use an attribute in this method, the values you provide, such as isolated subnet IDs, must match the existing values in length and order. Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_lookup&lt;/code&gt; method is recommended instead.&lt;/p&gt;

&lt;p&gt;Anyway. The returned &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my_vpc&lt;/code&gt; construct is an object of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws_ec2.Vpc&lt;/code&gt; construct class. So, you can use it while configuring an EC2 instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sample_app.sample_stack.py&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SampleStack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Construct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;construct_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;construct_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kwargs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;n&quot;&gt;my_vpc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Vpc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;from_lookup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;MyVpc&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpc_id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;vpc-0f8a1264829501695&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;n&quot;&gt;my_server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;WebServer&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                    &lt;span class=&quot;n&quot;&gt;vpc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;my_vpc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                    &lt;span class=&quot;n&quot;&gt;instance_type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstanceType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instance_class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstanceClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;T3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instance_size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstanceSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MICRO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
                                    &lt;span class=&quot;n&quot;&gt;machine_image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MachineImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;latest_amazon_linux2023&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;            
                                &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;bp&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Please note how we assign the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my_vpc&lt;/code&gt; variable representing the imported VPC to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vpc_id&lt;/code&gt; attribute. Its usage is the same as that of a VPC construct you created from scratch in the same app.&lt;/p&gt;

&lt;p&gt;Many L2-level CDK constructs provide the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_xxx&lt;/code&gt; class methods similar to importing an existing resource, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xxx&lt;/code&gt; changes according to the resource type. For example, you can import an existing AWS CodeCommit repository using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_repository_arn&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_repository_name&lt;/code&gt; class methods of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws_codecommit.Repository&lt;/code&gt; construct by providing the repository ARN or repository name, respectively. But unlike &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws_ec2.Vpc&lt;/code&gt;, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws_codecommit.Repository&lt;/code&gt; construct doesn’t provide the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_lookup&lt;/code&gt; method. So, it would be best if you referred to the CDK Construct Library reference for the import method of your L2-level construct class. But they often begin with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;from_&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;learn-aws-cdk-with-python&quot;&gt;Learn AWS CDK with Python!&lt;/h2&gt;

&lt;p&gt;Would you like to learn how to initialize new CDK apps and define your L1, L2 constructs, or CDK patterns (L3)? By joining &lt;a href=&quot;https://www.udemy.com/course/aws-cdk-with-python-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;my online AWS CDK course on Udemy&lt;/a&gt;, you can learn AWS CDK with Python as the programming language, from the most basic features to advanced concepts like CDK aspects and testing constructs.&lt;/p&gt;

&lt;div class=&quot;row mb-2 mt-3&quot;&gt;
  &lt;div class=&quot;col-md-2&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-8&quot;&gt;
    
    &lt;a href=&quot;https://www.udemy.com/course/aws-cdk-with-python-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;
    
    








&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/../courses/cdk-logo-lg-v1.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/../courses/cdk-logo-lg-v1.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/../courses/cdk-logo-lg-v1.jpg&quot; alt=&quot;AWS CDK with Python Step by Step&quot; /&gt;
    
&lt;/picture&gt;
    
    &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-2&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;With this course, I helped many people like you to understand AWS CDK concepts with practical hands-on examples. Besides, as a reader of this blog, you can join my &lt;a href=&quot;https://www.udemy.com/course/aws-cdk-with-python-step-by-step/?couponCode=SHIKISOFT-LEARN-2603&quot;&gt;AWS CDK with Python Step by Step&lt;/a&gt; course with a special discount using the links provided in this post.&lt;/p&gt;

&lt;p&gt;So, enroll today and start learning AWS CDK step by step!&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Sometimes, you need to reference an existing AWS resource in your CDK apps. In this post, I provided some insights into importing your resources as CDK constructs using the class methods provided by L2-level CDK constructs. I hope you find it helpful while using AWS CDK.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/cdk/v2/guide/environments.html&quot;&gt; CDK Environments - CDK Developer Guide &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html&quot;&gt;AWS CDK Construct Library Reference&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ec2/Vpc.html&quot;&gt; aws_cdk.Vpc Constuct - Python Reference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;d-none&quot;&gt;
  &lt;div class=&quot;row mb-1&quot;&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;col-md-10&quot;&gt;
    
      








&lt;picture class=&quot;m-0&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/20240424-cdk/aws-cdk-import-resource.webp&quot; type=&quot;image/webp&quot; /&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/20240424-cdk/aws-cdk-import-resource.jpg&quot; type=&quot;image/jpeg&quot; /&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block webfeedsFeaturedVisual&quot; src=&quot;/images/post_imgs/20240424-cdk/aws-cdk-import-resource.jpg&quot; alt=&quot;Shikisoft Blog - Importing existing AWS resources to AWS CDK stacks&quot; width=&quot;1289&quot; height=&quot;850&quot; /&gt;
    
&lt;/picture&gt;
    
  &lt;/div&gt;
  &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;!-- 









&lt;picture class=&quot;m-2&quot;&gt;
    &lt;source srcset=&quot;/images/post_imgs/folder/image-name.webp&quot; type=&quot;image/webp&quot;&gt;
    
        &lt;source srcset=&quot;/images/post_imgs/folder/image-name.jpg&quot; type=&quot;image/jpeg&quot;&gt;
        &lt;img class=&quot;img-fluid mx-auto d-block &quot; src=&quot;/images/post_imgs/folder/image-name.jpg&quot; alt=&quot;image description&quot; width=XXX height=XXX&gt;
    
&lt;/picture&gt;
 --&gt;</content><author><name>Emre Yilmaz</name></author><category term="AWS CDK" /><summary type="html"></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.shikisoft.com/20240424-cdk/aws-cdk-import-resource.webp" /><media:content medium="image" url="https://blog.shikisoft.com/20240424-cdk/aws-cdk-import-resource.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>