<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paul Marsicovetere</title>
    <description>The latest articles on DEV Community by Paul Marsicovetere (@paulmarsicloud).</description>
    <link>https://dev.to/paulmarsicloud</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F701343%2Fcf8dfcbc-84b3-44c2-bade-b6eeda6be643.jpeg</url>
      <title>DEV Community: Paul Marsicovetere</title>
      <link>https://dev.to/paulmarsicloud</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paulmarsicloud"/>
    <language>en</language>
    <item>
      <title>So you wanna learn some AWS skills huh?</title>
      <dc:creator>Paul Marsicovetere</dc:creator>
      <pubDate>Tue, 13 Dec 2022 15:17:30 +0000</pubDate>
      <link>https://dev.to/aws-builders/so-you-wanna-learn-some-aws-skills-huh-47h5</link>
      <guid>https://dev.to/aws-builders/so-you-wanna-learn-some-aws-skills-huh-47h5</guid>
      <description>&lt;p&gt;A common skill found on many job postings in the Site Reliability Engineering (SRE)/DevOps/Cloud Infrastructure space is knowledge and experience in Amazon Web Services (AWS). While this requirement doesn’t guarantee that AWS will be the cloud provider used forever at each company, or will even be a required skill for the long-term, Amazon the company and AWS the cloud platform have been the market leader for around 11 straight years now. There are typically a variety of questions typically asked from those just starting their cloud learning journey such as “How do you learn AWS?”, “How do you get involved with using AWS?” and “How do you get good at AWS?”. There are truly an endless number of resources to answer those questions, but today I would like to recommend my go-to areas for anyone completely unfamiliar with AWS entirely. As a word of encouragement: If I can learn this, anyone can 🙂&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zeX8_QtP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr8kesjg60hn7v7dmhdf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zeX8_QtP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr8kesjg60hn7v7dmhdf.jpg" alt="colored books stacked" width="880" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create your own AWS Account
&lt;/h2&gt;

&lt;p&gt;Creating your own AWS account has great benefits for learning as it can be used for testing out whatever products and services you see fit. Depending on your current employer, you may work in an organization that limits what exactly can be provisioned and where. However, with your own AWS account, you will have free range to learn all about the services without impacting any production environments or money-making applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 When creating your own brand new AWS account it is important to add the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A budget alarm to notify you when the monthly budget is approaching. AWS has a generous &lt;a href="https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;amp;all-free-tier.sort-order=asc&amp;amp;awsf.Free%20Tier%20Types=*all&amp;amp;awsf.Free%20Tier%20Categories=*all"&gt;free tier&lt;/a&gt; for its services, however outside of the free tier limits and timeframes, certain services like Managed NAT Gateways, Elastic IPs or unattached EBS volumes can cause the monthly bill to increase. This budget alarm will help greatly in the event bad actors access and use your account for unwanted activities. You are responsible for the billing of these activities, so being alerted early can help save you from an unexpectedly large bill.&lt;/li&gt;
&lt;li&gt;Multi-Factor Authentication (MFA) to the root AWS account and any IAM users created to further reduce the security threat of being compromised.
## Check out AWS Skill Builder&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;AWS Skill Builder is an online resource that provides many learning courses all for free, and you can sign up using an Amazon account. These courses are provided directly by AWS, so any bias or subjective viewpoints that you may/may not encounter from other non-AWS provided courses are not present. There are learning plans that are focused on both ramping up skills and taking AWS certifications, and for beginners, I would recommend taking a look at the AWS &lt;a href="https://explore.skillbuilder.aws/pages/56/aws-ramp-up-guides"&gt;Ramp Up Guides&lt;/a&gt;, particularly focusing on the &lt;a href="https://d1.awsstatic.com/training-and-certification/ramp-up_guides/Ramp-Up_Guide_CloudPractitioner.pdf"&gt;Cloud Foundations Guide&lt;/a&gt;. The &lt;a href="https://explore.skillbuilder.aws/learn/learning_plan/view/82/cloud-foundations-learning-plan"&gt;Cloud Foundations Learning Plan&lt;/a&gt; is a 13-hour course that provides an overview of many of the foundational aspects of AWS. The Ramp Up Guides are also geared towards Role, Domain and Industry so there should truly be a guide and learning path for everyone at every level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sign up for an AWS certification and subscription courses
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;To certify, or not to certify: that is the question.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Certifications are sometimes a hot-button topic in our industry, and there are valid arguments for and against obtaining AWS certifications in particular. Do these AWS certifications guarantee you understand AWS completely? Absolutely not. Will an AWS certification demonstrate you have &lt;em&gt;some&lt;/em&gt; knowledge of AWS concepts and services? I would argue yes. The truth is that there are some incredible engineers that have zero certifications and are far more talented and knowledgeable than some engineers with certifications, AWS Certifications can assist engineers in their careers and provide a framework for learning. Having AWS certifications can increase the number of job opportunities that an engineer is contacted about, and the knowledge gained can be applied to different projects and services in your professional life. Certifications are &lt;strong&gt;not&lt;/strong&gt; a &lt;strong&gt;must-have&lt;/strong&gt; for everyone, however, they offer some benefits and help demonstrate a basic understanding of certain AWS services.&lt;/p&gt;

&lt;p&gt;If you are interested in obtaining an AWS certification, I would advise starting with the &lt;a href="https://aws.amazon.com/certification/certified-cloud-practitioner/?ch=sec&amp;amp;sec=rmg&amp;amp;d=1"&gt;Cloud Practitioner&lt;/a&gt; and/or &lt;a href="https://aws.amazon.com/certification/certified-solutions-architect-associate/?ch=sec&amp;amp;sec=rmg&amp;amp;d=1"&gt;Solutions Architect - Associate&lt;/a&gt; exam(s). To prepare for these exams, there are some quality online learning courses through the &lt;a href="https://www.aws.training/"&gt;AWS Training and Certification&lt;/a&gt; website, &lt;a href="https://acloudguru.com/"&gt;A Cloud Guru&lt;/a&gt; (my personal favourite), &lt;a href="https://learn.cantrill.io/courses"&gt;Cantrill&lt;/a&gt; or &lt;a href="https://www.udemy.com/user/stephane-maarek/"&gt;Udemy&lt;/a&gt;. These are just &lt;em&gt;some&lt;/em&gt; of the &lt;strong&gt;many&lt;/strong&gt; courses available that are geared toward passing the AWS certifications.&lt;/p&gt;

&lt;p&gt;Fortunately, at Formidable, we have a generous "&lt;a href="https://formidable.com/about/"&gt;All-you-can-eat professional development budget&lt;/a&gt;" so if you can have your employer cover the costs of these learning courses, that makes it all the more enticing to sign up!&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge yourself by building things!
&lt;/h2&gt;

&lt;p&gt;Sometimes there is no better substitute for learning than getting your hands dirty and seeing what can be created when using AWS. There are countless user instruction guides (for example the &lt;a href="https://aws.amazon.com/developer/"&gt;AWS Developer Center&lt;/a&gt;) on many different and wide-ranging services that can be built on AWS and these are easily found on the AWS website. However, it’s advisable to start with something small and iterate from there as this will provide better motivation to keep your learning progressing. Yes, AWS can seem very daunting due to the sheer size (&lt;a href="https://aws.amazon.com/what-is-aws/"&gt;over 200!&lt;/a&gt;) of services provided; but you do not need to start with learning the hardest or most complex tasks to gain an understanding of AWS.&lt;/p&gt;

&lt;p&gt;For example; this is my &lt;a href="https://www.thecloudonmymind.com/"&gt;personal blog&lt;/a&gt; initially created with S3, CloudFront, Amazon Certificate Management (ACM) and Route53. Since then, Amazon Polly text-to-speech capabilities, and a CI/CD pipeline to automate deployment to S3, have been added as well. Further, an on-demand, ephemeral OpenVPN &lt;a href="https://www.thecloudonmymind.com/A-free-ephemeral-openvpn-via-EC2-and-Terraform/"&gt;service&lt;/a&gt; that runs on EC2 was also created, demonstrating the different projects that can be created with the many AWS services available. The learnings gained when building out these services, alongside my professional duties, have been immense; but you do not need to create the world’s most sophisticated service to learn AWS well. Building new projects and tools as well as using the services on AWS provides knowledge and experience that cannot be replicated simply by sitting certification exams or undertaking learning classes and courses. Learning how to successfully work with CloudFront cache invalidation to update a website’s static assets is much more valuable than simply &lt;em&gt;knowing&lt;/em&gt; about that feature. While a certification or learning plan will explain this particular concept and &lt;em&gt;why&lt;/em&gt; it is important, in my opinion, the knowledge becomes ingrained when you run the commands and see the results for yourself.&lt;/p&gt;

&lt;p&gt;A good way to build something and gain knowledge in AWS I have come across is &lt;a href="https://cloudresumechallenge.dev/docs/the-challenge/aws/"&gt;The Cloud Resume Challenge - AWS&lt;/a&gt;. It requires the usage of some key AWS services and is truly awesome for folks just getting started with AWS or software engineering as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If anyone looks online or asks about the best way to learn AWS, they will receive a million different opinions and answers. Truthfully, there is no &lt;em&gt;right&lt;/em&gt; or &lt;em&gt;wrong&lt;/em&gt; way to gain a deeper understanding of AWS, just different learning paths you can take to get there.&lt;/p&gt;

&lt;p&gt;It is important to try and understand what &lt;em&gt;your&lt;/em&gt; ideal learning style is and center your learning path around that for the best chance at success. Some engineers can simply read pages upon pages of technical documentation (and some who get by &lt;strong&gt;only&lt;/strong&gt; reading the Linux &lt;code&gt;man&lt;/code&gt; docs!) and that has worked very well for them. Others, like myself, enjoy video tutorials with lab-based learning, along with building out personal projects.&lt;/p&gt;

&lt;p&gt;So whatever, your learning style is, whether it be reading the technical documentation, watching video tutorials, or drawing mind maps, try to cater and tailor your AWS learning path around that and the knowledge will follow. Good luck to everyone on their AWS learning journey!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>cloud</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Version 1 Terraform AWS OpenVPN Ephemeral Released!</title>
      <dc:creator>Paul Marsicovetere</dc:creator>
      <pubDate>Thu, 13 Oct 2022 14:26:57 +0000</pubDate>
      <link>https://dev.to/aws-builders/version-1-terraform-aws-openvpn-ephemeral-released-4735</link>
      <guid>https://dev.to/aws-builders/version-1-terraform-aws-openvpn-ephemeral-released-4735</guid>
      <description>&lt;p&gt;I have had a little spare time recently to revisit my beloved &lt;a href="https://github.com/paulmarsicloud/terraform-aws-openvpn-ephemeral" rel="noopener noreferrer"&gt;terraform-aws-openvpn-ephemeral&lt;/a&gt; repo and module and give it a much-needed cleanup. As a result, I've now published an official version 1.0.0 and I am super stoked with how it operates! Further, I even set up an &lt;a href="https://github.com/paulmarsicloud/openvpn-ephemeral-github-actions-template" rel="noopener noreferrer"&gt;openvpn-ephemeral-github-actions-template&lt;/a&gt; repo using GitHub Actions as another method to use CI/CD with this module, building off the previous work using &lt;a href="https://www.thecloudonmymind.com/Using-CI-CD-to-automate-OpenVPN/" rel="noopener noreferrer"&gt;GitLab and CircleCI&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Back Better
&lt;/h2&gt;

&lt;p&gt;It's been about a year since I last made any meaningful updates to the &lt;a href="https://registry.terraform.io/modules/paulmarsicloud/openvpn-ephemeral/aws/latest" rel="noopener noreferrer"&gt;openvpn-ephemeral terraform module&lt;/a&gt; as I was attempting to use the service from my machine and noticed a few different odd and interesting errors. As I reviewed the module, I had a "wow, this code is terrible" moment as I questioned the architecture choices I had &lt;a href="https://www.thecloudonmymind.com/A-free-ephemeral-openvpn-via-EC2-and-Terraform/" rel="noopener noreferrer"&gt;made previously&lt;/a&gt;. In a way, I am happy because while I could have easily made these newer architectural decisions back then, the service and module were still launched and usable this time last year. Now after reviewing the architecture I have realized that it was &lt;em&gt;way&lt;/em&gt; overcomplicated (and still might be) but as they say "perfect is the enemy of good enough". Version 0 previously released worked just fine, but now, it works even better.&lt;/p&gt;

&lt;p&gt;So what were the changes? For starters, the previous setup required AWS SSM Manager to download the created OpenVPN file created by the EC2 instance. AWS SSM Manager is in my opinion, non-trivial to set up, especially when you are relying on your own personal machine or containers in CI/CD to use AWS SSM Manager to download the files you need from an EC2 instance. An easier solution? S3!&lt;/p&gt;

&lt;p&gt;By swapping out downloading the OpenVPN file via AWS SSM Manager for S3, basically, Terraform creates a private S3 bucket and the EC2 instance creates the OpenVPN file and uploads the file there. Then, Terraform also downloads the OpenVPN file from S3 for you. This negates the need for a &lt;code&gt;tls_private_key&lt;/code&gt; pem certificate and &lt;code&gt;aws_key_pair&lt;/code&gt; resources as well! Having to use AWS SSM Manager to scp the file securely is a bit &lt;em&gt;clunky&lt;/em&gt; and be just as securely achieved using a private S3 bucket that only your AWS Account has access to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Terragrunt
&lt;/h2&gt;

&lt;p&gt;Another thing I realized was that using local Terraform state and passing it around in CI/CD for GitLab and CircleCI was also completely unnecessary and can be efficiently changed by using &lt;a href="https://terragrunt.gruntwork.io/" rel="noopener noreferrer"&gt;Terragrunt&lt;/a&gt;. Terragrunt has a superior way than Terraform to set up a remote S3/DynamoDB backend for your Terraform State and Locks, and example &lt;code&gt;terragrunt.hcl&lt;/code&gt; files are provided in the updated &lt;a href="https://github.com/paulmarsicloud/terraform-aws-openvpn-ephemeral/tree/main/examples" rel="noopener noreferrer"&gt;examples&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Using a remote S3/DynamoDB backend for the Terraform State means that you can set up a private repo in SCM and then download that repo from any machine, run your Terragrunt commands and the OpenVPN instance will be created for you. This has great advantages in case the state is ever compromised mid-run; you can simply download the state elsewhere and fix things, rather than having to manually go and clean up the resources previously.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improved Docker Image
&lt;/h2&gt;

&lt;p&gt;One of the changes I am most proud and fond of is the creation of the &lt;a href="https://hub.docker.com/r/paulmarsicloud/terragrunt-awscli" rel="noopener noreferrer"&gt;terragrunt-awscli&lt;/a&gt; Docker image. The image is created with just &lt;strong&gt;two lines!&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM alpine/terragrunt
RUN apk add --no-cache aws-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://hub.docker.com/r/alpine/terragrunt" rel="noopener noreferrer"&gt;alpine/terragrunt&lt;/a&gt; image has Terragrunt and Terraform, so this new &lt;code&gt;terragrunt-awscli&lt;/code&gt; image just adds the &lt;code&gt;aws-cli&lt;/code&gt; on top. This is done as Terraform downloads the OpenVPN file from S3 via the AWS CLI, so it needs to be present.&lt;/p&gt;

&lt;p&gt;Previously, the Docker image &lt;a href="https://hub.docker.com/r/paulmarsicloud/terraform-aws-ssh" rel="noopener noreferrer"&gt;terraform-aws-ssh&lt;/a&gt; was used. This image was around ~272MB whereas the &lt;code&gt;terragrunt-awscli&lt;/code&gt; image is only &lt;strong&gt;90MB!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7h6gzmzhvdgzjeszm4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7h6gzmzhvdgzjeszm4z.png" alt="everyone loves small docker images!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This should result in faster builds in CI/CD, saving precious minutes on the free tier in GitLab, CircleCI and ... GitHub Actions!&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Actions
&lt;/h2&gt;

&lt;p&gt;I have been using GitHub Actions in my professional life recently, and it is quite a different CI/CD tool compared to GitLab, CircleCI or Jenkins, to which I have previously been exposed.&lt;/p&gt;

&lt;p&gt;However, I have been impressed with GitHub Actions simplicity. I've come to accept that to have a decent CI/CD pipeline, you need to write some decent YAML. I put together this &lt;a href="https://github.com/paulmarsicloud/openvpn-ephemeral-github-actions-template" rel="noopener noreferrer"&gt;openvpn-ephemeral-github-actions-template&lt;/a&gt; repo, similar to the &lt;a href="https://github.com/paulmarsicloud/openvpn-ephemeral-circleci-template" rel="noopener noreferrer"&gt;circleci-template&lt;/a&gt; and &lt;a href="https://gitlab.com/paulmarsicloud/openvpn-ephemeral-template/" rel="noopener noreferrer"&gt;gitlab-template&lt;/a&gt; counterparts to show how to use GitHub Actions with the OpenVPN Terraform module.&lt;/p&gt;

&lt;p&gt;It kind of sucks that with GitHub Actions you have to have separate workflows for OpenVPN create and destroy processes, as having "manual approvals" or pauses in workflows is quite convoluted to set up in GitHub Actions. However, this is not the end of the world and honestly makes for an easy UI experience for start and stop. I would rank GitHub Actions as a solid second choice behind GitLab for using CI/CD with this workflow. GitLab slightly edges out and takes the first position because it has Manual Approval buttons for each create and destroy jobs, so you can have one workflow file for all your regions, rather than have these separated as you do for GitHub Actions. The CircleCI workflow is definitely still the least desirable of the three 😀&lt;/p&gt;

&lt;p&gt;GitHub Actions also has a decent &lt;a href="https://github.com/pricing" rel="noopener noreferrer"&gt;free tier&lt;/a&gt; of 2,000 CI/CD minutes per month, equating to ~500 minutes per week. The build and destroy jobs take roughly 4-5 mins each at &lt;strong&gt;max&lt;/strong&gt; so the VPN could be started and stopped around 14 times per day before you would hit the free tier limits. More than enough for my personal use case!&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to next?
&lt;/h2&gt;

&lt;p&gt;Not being able to sit still, I am already thinking about how to make this service offering even better, and there are certainly a lot of obvious solutions to consider. I will probably set up things in Terraform as an Auto Scaling Group that scales to 0 when you are done with the instance. This would allow for a faster startup time (presumably) as you are not having to create the instance, role, policy and bucket from scratch each time you wish to create.&lt;/p&gt;

&lt;p&gt;I definitely also want to use the learnings from version 1 and earlier, to set up a service that has a complete front-end for even easier use when creating OpenVPN access. A simple password-protected site where you click the region you want a VPN for and it downloads the OpenVPN profile file for you surely can't be that hard right?&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Refactoring your code is awesome, and you should try and use fewer resources whenever possible&lt;/li&gt;
&lt;li&gt;GitHub Actions is a solid CI/CD tool for starting/stopping OpenVPN EC2 instances&lt;/li&gt;
&lt;li&gt;Releasing Version 1 of anything will &lt;em&gt;release&lt;/em&gt; your own endorphins!&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>terraform</category>
      <category>openvpn</category>
      <category>cicd</category>
    </item>
    <item>
      <title>OIDC Forever, IAM Credentials Never!</title>
      <dc:creator>Paul Marsicovetere</dc:creator>
      <pubDate>Thu, 08 Sep 2022 17:23:57 +0000</pubDate>
      <link>https://dev.to/aws-builders/oidc-forever-iam-credentials-never-4hhf</link>
      <guid>https://dev.to/aws-builders/oidc-forever-iam-credentials-never-4hhf</guid>
      <description>&lt;p&gt;Let me ask you a difficult question: how often are you &lt;em&gt;really&lt;/em&gt; rotating your IAM credentials? Secondly, if there were a security breach and someone had access to those IAM credentials, how quickly would you be able to detect it?&lt;/p&gt;

&lt;p&gt;Security is something that nobody in tech likes to take for granted and is an area that is constantly changing and evolving as more and more threats are detected every day.&lt;/p&gt;

&lt;p&gt;About 8 months or so ago I was thinking to myself "I really need to update and rotate the IAM Credentials I use for this blog". I was namely thinking of this because while it is good security practice to rotate your keys, unfortunately, there's no "automatic" way to do this within AWS, short of writing a Lambda and hooking this into Secrets Manager and/or SES for reminders of key rotation. I was researching the most straightforward way to automate these key renewals say every 90 days and then auto-uploading those keys to the services that use these particular keys (in my case Terraform Cloud and CircleCI). However, after spending a few hours digging in, I quickly realized that this would not be that straightforward and that it was actually &lt;strong&gt;way faster&lt;/strong&gt; for me to simply log into my AWS account every 90 days, rotate the keys, and then upload these to CircleCI and Terraform.&lt;/p&gt;

&lt;p&gt;However, I recently listened to this &lt;a href="https://awsbites.com/45-what-s-the-magic-of-oidc-identity-providers/"&gt;AWS Bites podcast episode&lt;/a&gt; and thought "hrmm...ok, maybe I'll just switch up my blog's CI/CD to GitHub Actions so I can use this awesome OpenID Connect (OIDC) functionality".&lt;/p&gt;

&lt;p&gt;And then I read this great &lt;a href="https://circleci.com/blog/openid-connect-identity-tokens/"&gt;CircleCI blog post&lt;/a&gt; 😄&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding why OIDC is superior to IAM credentials
&lt;/h2&gt;

&lt;p&gt;So the standard process has typically been to: create an IAM user with programmatic keys, give that user permissions of least privilege, and then upload the IAM credential keys to the service provider that will be making changes to your AWS infrastructure (again in my case Terraform Cloud and CircleCI) on your behalf.&lt;/p&gt;

&lt;p&gt;When you really think about it, storing your IAM credentials in any service provider has its limitations. I like to think of providing IAM credentials to a service similar to giving my credit card details to a service (e.g. CircleCI). I &lt;em&gt;trust&lt;/em&gt; CircleCI to not do anything nefarious with my details, but if my card details are stored in the service and that service for whatever reason becomes compromised, that credit card can be used by &lt;strong&gt;anyone&lt;/strong&gt; (or any service) that has the details. This is no different from IAM credentials and provides us with a good reason as to why you always want to pair down the permissions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;side note: please, &lt;strong&gt;please&lt;/strong&gt; don't create an IAM user with programmatic keys that has &lt;code&gt;AdministratorAccess&lt;/code&gt; permissions to your AWS Account that you then upload those IAM credentials to these third-party services. You are basically giving anyone or any service the ability to create anything (well...within service quota limits) within your AWS account by doing so. You personally don't want that or want to deal with an unexpected large AWS bill shortly after! 😅&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Continuing the credit card analogy; so instead of giving our credit card details to a service, what if there is a way to give only card &lt;em&gt;authorization&lt;/em&gt; to that one service? Well, that sounds more like OIDC! The benefit is that you are only authorizing/allowing the service to use your credit card, meaning that there are no credit card details to be leaked, only card &lt;em&gt;authorization&lt;/em&gt; details. If the card authorization details were somehow leaked, these are actually kind of worthless, as only that particular service is &lt;em&gt;authorized&lt;/em&gt; to use them, not some other random third party! 🎉&lt;/p&gt;

&lt;p&gt;I'm confident there will come a day soon when some hacker will figure out how to spoof the service that has the OIDC Identity provider authorization permission (e.g. a hacker spoofing CircleCI can then access your AWS infrastructure &lt;em&gt;based on the policies&lt;/em&gt; attached to the OIDC provider), but for now this setup seems a whole lot more secure than storing your IAM credentials directly at the service and having to remember to rotate your access keys every so often. Further, if the IAM credentials are leaked, you really have to rotate them &lt;strong&gt;quickly&lt;/strong&gt; or risk your AWS account/services being compromised. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to setup an OIDC Identity Provider with CircleCI in AWS
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start by logging into CircleCI and then go to Organization Settings &amp;gt; then copy your organization ID&lt;/li&gt;
&lt;li&gt;Log into the AWS console, and head to IAM.&lt;/li&gt;
&lt;li&gt;Go to Identity Providers (under Access Management) and click "Add Provider"&lt;/li&gt;
&lt;li&gt;Choose "OpenID Connect"&lt;/li&gt;
&lt;li&gt;In Provider URL enter &lt;code&gt;https://oidc.circleci.com/org/&amp;lt;INSERT ORGANIZATION ID HERE&amp;gt;&lt;/code&gt; (e.g. &lt;code&gt;https://oidc.circleci.com/org/th1s-i5-n0t-a-0rg1d&lt;/code&gt;) and then click "Get Thumbprint"&lt;/li&gt;
&lt;li&gt;In Audience, enter the same Organization ID&lt;/li&gt;
&lt;li&gt;Click "Add Provider" and the provider should be created!&lt;/li&gt;
&lt;li&gt;Next, go to Roles (under Access Management)&lt;/li&gt;
&lt;li&gt;Click "Create Role" and select "Web Identity"&lt;/li&gt;
&lt;li&gt;In Identity Provider select the CircleCI identity provider that was just created.&lt;/li&gt;
&lt;li&gt;In Audience, select the Organization ID and click Next to add permissions&lt;/li&gt;
&lt;li&gt;In Permissions, you will be selecting or creating policies based on what your CircleCI pipelines should have permission to do. This will vary case by case. For example, my CICD pipelines need only access to S3 and CloudFront services to publish my blog posts.&lt;/li&gt;
&lt;li&gt;Click Create Role and when complete, copy this Role's ARN, you are good from the AWS perspective!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using OIDC as your AWS credentials in CircleCI
&lt;/h2&gt;

&lt;p&gt;Before making any changes to your CircleCI pipeline, as per the &lt;a href="https://circleci.com/docs/openid-connect-tokens"&gt;OpenID Connect Tokens doc&lt;/a&gt;, you &lt;strong&gt;will&lt;/strong&gt; need to create a context for your job, which can be done using &lt;a href="https://circleci.com/docs/contexts"&gt;these steps&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you have a &lt;code&gt;context&lt;/code&gt; created and added to the workflow section of your pipeline job, you can now edit your CircleCI pipeline to include the OpenID Connect token to utilize our newly created IAM role. For example, using &lt;a href="https://circleci.com/docs/openid-connect-tokens#adding-aws-to-the-circleci-configuration-file"&gt;these directions&lt;/a&gt;, my &lt;code&gt;.circleci/config.yml&lt;/code&gt; file was changed from this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: 2.1
jobs:
  www:
    docker:
      - image: paulmarsicloud/hexo-aws:2.1
    working_directory: ~/hexo-cloudonmymindblog
    steps:
      - checkout
      - run:
          name: Generate static website
          command: hexo generate
      - run:
          name: Push to S3 bucket
          command: cd public/ &amp;amp;&amp;amp; aws s3 sync . s3://www.thecloudonmymind.com
      - run:
          name: Invalidate Cloudfront
          command: aws cloudfront create-invalidation --distribution-id &amp;lt;REDACTED&amp;gt; --paths "/*" --no-cli-pager
workflows:
    version: 2
    build_and_deploy:
      jobs:
        - www:
            context:
              - cloudonmymind-web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: 2.1
jobs:
  www:
    docker:
      - image: paulmarsicloud/hexo-aws:2.1
    environment:
      AWS_DEFAULT_REGION: &amp;lt;ENTER YOUR REGION HERE&amp;gt;
      AWS_ROLE_ARN: &amp;lt;ENTER YOUR IAM ROLE ARN HERE&amp;gt;
    working_directory: ~/hexo-cloudonmymindblog
    steps:
      - checkout
      - run:
          name: Generate static website
          command: hexo generate
      - run:
          name: authenticate-and-interact, Push to S3 bucket, Invalidate CloudFront
          command: |
            # use the OpenID Connect token to obtain AWS credentials
            read -r AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \&amp;lt;&amp;lt;&amp;lt; \
              $(aws sts assume-role-with-web-identity \
               --role-arn ${AWS_ROLE_ARN} \
               --role-session-name "CircleCI-${CIRCLE_WORKFLOW_ID}-${CIRCLE_JOB}" \
               --web-identity-token $CIRCLE_OIDC_TOKEN \
               --duration-seconds 3600 \
               --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' \
               --output text)
            export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
            # interact with AWS
            aws sts get-caller-identity --no-cli-pager
            cd public/ &amp;amp;&amp;amp; aws s3 sync . s3://www.thecloudonmymind.com
            aws cloudfront create-invalidation --distribution-id &amp;lt;REDACTED&amp;gt; --paths "/*" --no-cli-pager
workflows:
    version: 2
    build_and_deploy:
      jobs:
        - www:
            context:
              - cloudonmymind-web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So for the eagle-eyed reader, you'll notice a few interesting pieces. Firstly, the addition of &lt;code&gt;--no-cli-pager&lt;/code&gt; is necessary &lt;em&gt;probably&lt;/em&gt; only for the docker image used &lt;a href="https://hub.docker.com/r/paulmarsicloud/hexo-aws"&gt;&lt;code&gt;paulmarsicloud/hexo-aws:2.1&lt;/code&gt;&lt;/a&gt;. This is a custom docker image I created that has both &lt;code&gt;hexo&lt;/code&gt; and the &lt;code&gt;aws-cli&lt;/code&gt; installed, as this blog/site uses the &lt;a href="https://www.thecloudonmymind.com/step_3/"&gt;Hexo platform&lt;/a&gt;. By adding the &lt;code&gt;--no-cli-pager&lt;/code&gt; option, I no longer receive a &lt;code&gt;Unable to redirect output to pager.&lt;/code&gt; error 👍&lt;/p&gt;

&lt;p&gt;Secondly, I had to combine the &lt;code&gt;Push to S3 bucket&lt;/code&gt; and &lt;code&gt;Invalidate Cloudfront&lt;/code&gt; steps into one during testing, as it seems that the &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;export&lt;/code&gt; commands need to be run per step. I tried having just a singular &lt;code&gt;authenticate-and-interact&lt;/code&gt; step, but subsequent steps that ran &lt;code&gt;aws cli&lt;/code&gt; commands would fail with a &lt;code&gt;Unable to locate credentials. You can configure credentials by running "aws configure"&lt;/code&gt; error. I will need to sit down and spend some further time testing out and potentially refactoring my CircleCI steps and pipeline as I am sure there is a way to somehow cache or pass the credentials from one step to another, rather than having to write and execute those &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;export&lt;/code&gt; commands each time you want to run an &lt;code&gt;aws-cli&lt;/code&gt; command. When I have the answer, ya'll will be the first to know!&lt;/p&gt;

&lt;p&gt;In a way, it makes &lt;em&gt;more&lt;/em&gt; sense to have these S3 and CloudFront AWS commands run in one step, even though for readability purposes, I personally like to have a &lt;strong&gt;"one command per step"&lt;/strong&gt; layout for my CI/CD pipelines. It's truly a "6 in one, half a dozen in the other" kinda deal though.&lt;/p&gt;

&lt;p&gt;Here's a &lt;a href="https://gist.github.com/paulmarsicloud/bbdd247d1a95af0fe92f75f5d7c3ba4e"&gt;link to the gist&lt;/a&gt; of my final updated &lt;code&gt;.circleci/config.yml&lt;/code&gt; if you need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Terraform Cloud
&lt;/h2&gt;

&lt;p&gt;Unfortunately as per &lt;a href="https://discuss.hashicorp.com/t/oidc-auth-aws-azure/35463"&gt;this discussion&lt;/a&gt; Terraform Cloud does not support OIDC Identity. This is discouraging to see and as a result, I will be moving my Terraform state out of Terraform Cloud shortly and will set up an S3 Bucket/DynamoDB table for the state/lock. I initially set up this &lt;a href="https://www.thecloudonmymind.com/step_2/"&gt;blog with Terraform Cloud&lt;/a&gt; to try it out and have automated Terraform runs, but now I will be switching to CircleCI (or GitHub Actions) so that I can utilize the awesomeness of OIDC!&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of OIDC over IAM credentials
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Sounder sleep knowing that my IAM credentials won't be leaked for someone or some service to use and compromise my AWS infrastructure&lt;/li&gt;
&lt;li&gt;No need to set up anything custom or any reminders to manually rotate the keys. All authorization is now done via the OIDC Identity Provider and corresponding IAM role - it was a rad feeling deleting the IAM credentials I had stored in CircleCI and still having the pipeline runs work!&lt;/li&gt;
&lt;li&gt;No way of accidentally forgetting to &lt;strong&gt;not&lt;/strong&gt; store your IAM keys in version/source control (this happens to folks all the time, even though everyone warns about it)&lt;/li&gt;
&lt;li&gt;OIDC providers are verified by AWS, so there is a &lt;em&gt;super&lt;/em&gt; low risk that an OIDC Providers "Thumbprint" would be spoofed for a particular large service (like CircleCI or GitHub Actions). When your IAM credentials are created and are then used for any service, anywhere, AWS doesn't ever verify &lt;em&gt;who&lt;/em&gt; exactly is using them. There is an implicit trust that if a user or service has the IAM credentials, they are authorized to use them. It is a totally different ball game with OIDC!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Think of IAM Credentials as your Credit Card vs an OIDC Provider as &lt;em&gt;authorization&lt;/em&gt; to &lt;strong&gt;use&lt;/strong&gt; your Credit Card 🙂&lt;/li&gt;
&lt;li&gt;OIDC Providers are quick and simple to setup in AWS and roll into your new or existing CircleCI pipelines&lt;/li&gt;
&lt;li&gt;You never need to rotate OIDC providers...you can't say the same for IAM Credentials!&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>oidc</category>
      <category>iam</category>
      <category>security</category>
    </item>
  </channel>
</rss>
