๐Ÿ“š AWS 1x1

ษชแด…แด‡ษดแด›ษชแด›ส- & แด€แด„แด„แด‡๊œฑ๊œฑ แดแด€ษดแด€ษขแด‡แดแด‡ษดแด› (ษชแด€แด) ๐Ÿ”‘

The concepts are crucial & being confident in them is a necessity.

From basics to advanced concepts ๐Ÿงตโ†“
For seriously working with AWS, there's no way around IAM.
Skipping to understand its core principles will bite you again and again in the future๏ธ ๐Ÿ”ฅ

Take the time to do a deep dive, so you won't be frustrated later.

{ 1/35 }
Thread Overview ๐Ÿงต

โ€ข IAMs Capabilities
โ€ข Key Terms
โ€ข Identity- & Resource-based Policies
โ€ข Securing your AWS Account
โ€ข Basics: Credentials & AWS CLI
โ€ข Dealing with "Access Denied"
โ€ข Least Privilege
โ€ข Permission Boundaries
โ€ข Tooling

{ 2/35 }
IAMs Capabilities ๐Ÿ—’

โ€ข managing users for your AWS account, with individual rights and/or temporary access
โ€ข enforcing password policies or MFA
โ€ข setting rights boundaries for AWS services & your apps
โ€ข identity federation
โ€ข ... and much more ๐Ÿ”

Take your time!

{ 3/35 }
Key Terms ๐Ÿ“š

โ€ข User: end-user, accessing the console or AWS API
โ€ข Group: a group of users, sharing the same privileges
โ€ข Policy: a defined list of permissions
โ€ข Role: a set of policies, that can be assumed by a user or AWS Service to gain those permissions

{ 4/35 }
At AWS IAM, everything evolves around ๐™‹๐™ค๐™ก๐™ž๐™˜๐™ž๐™š๐™จ

By default, all actions for all services are denied, so you have to explicitly grant rights by adding a policy with your targeted actions and resources to your service role, user, or group!

{ 5/35 }
You can attach one or multiple policies to a role and each policy can contain one or multiple ๐™Ž๐™ฉ๐™–๐™ฉ๐™š๐™ข๐™š๐™ฃ๐™ฉ๐™จ

Statements contain the permissions you want to grant and are structured in a specific way, defined as a JSON.

{ 6/35 }
An important detail about policies: they come in two different types!

โ€ข ๐˜๐˜ฅ๐˜ฆ๐˜ฏ๐˜ต๐˜ช๐˜ต๐˜บ-๐˜ฃ๐˜ข๐˜ด๐˜ฆ๐˜ฅ - attached to a user, group, or role.
โ€ข ๐˜™๐˜ฆ๐˜ด๐˜ฐ๐˜ถ๐˜ณ๐˜ค๐˜ฆ-๐˜ฃ๐˜ข๐˜ด๐˜ฆ๐˜ฅ - attached to a resource, e.g. S3 bucket, SQS queue, or KMS key.

We'll pick on this later.

{ 7/35 }
Let's have a look at what a ๐™Ž๐™ฉ๐™–๐™ฉ๐™š๐™ข๐™š๐™ฃ๐™ฉ must contain

โ€ข Effect - the indication if it's ๐˜ฟ๐™š๐™ฃ๐™ฎ or ๐˜ผ๐™ก๐™ก๐™ค๐™ฌ
โ€ข Action - a list of actions
โ€ข Resource - a list of resources for which the actions are granted

For resource-based policies, Resouce is optional.

{ 8/35 }
Resource-based Policies also need to define a ๐™‹๐™ง๐™ž๐™ฃ๐™˜๐™ž๐™ฅ๐™–๐™ก

It indicates for which account, (federated) user, or role user you'd like to allow/deny access.

There are more specifics for this type of policy like they aren't being affected by permission boundaries

{ 9/35 }
Your IAM knowledge foundation is laid!

Let's continue with securing your own AWS account!

It's not recommended to work with your root credentials. Those should only be used to enable MFA, create your first IAM user, and should then be locked away securely.

{ 10/35 }
Go to your security page & select ๐™ˆ๐™–๐™ฃ๐™–๐™œ๐™š ๐™ˆ๐™๐˜ผ ๐™™๐™š๐™ซ๐™ž๐™˜๐™š

You can use an authentication app of your choice.

Note: if there's already an Access Key, you can delete it as you shouldn't work with your root credentials in any way.

console.aws.amazon.com/iam/home?#secuโ€ฆ

{ 11/35 }
Afterward, you can create your first user by clicking on ๐™๐™จ๐™š๐™ง๐™จ > ๐˜ผ๐™™๐™™ ๐™๐™จ๐™š๐™ง

You can make use of AWS' predefined policies in the first place.

If you're working on a serious project, make sure to use groups to manage rights across different roles easily.

{ 12/35 }
After creating your user with enabled console access, you can now log out with your root user and log back in with your IAM user.

Note down your AWS' account identifier on the top right before logging out, because it's needed for the IAM user login.

{ 13/35 }
Credentials ๐Ÿ”‘

For accessing AWS' API to maintain your infrastructure via code, we'll need credentials

Go back to your security credentials page and click ๐˜พ๐™ง๐™š๐™–๐™ฉ๐™š ๐™–๐™˜๐™˜๐™š๐™จ๐™จ ๐™ ๐™š๐™ฎ to get your ๐˜ผ๐™˜๐™˜๐™š๐™จ๐™จ ๐™†๐™š๐™ฎ ๐™„๐˜ฟ & ๐™Ž๐™š๐™˜๐™ง๐™š๐™ฉ ๐˜ผ๐™˜๐™˜๐™š๐™จ๐™จ ๐™†๐™š๐™ฎ

{ 14/35 }
There's no way to display the Secret Access Key again, but you can create a new one at any time.

You can also have multiple keys for different purposes, which is also
recommended.

{ 15/35 }
AWS' Command Line Interface ๐Ÿ› 

Now that we've got our credentials, we can install AWS' CLI.
After installation, you can run ๐™–๐™ฌ๐™จ ๐™˜๐™ค๐™ฃ๐™›๐™ž๐™œ๐™ช๐™ง๐™š for doing our initial setup.

You'll be prompted for credentials some default settings.

aws.amazon.com/cli/

{ 16/35 }
When working with different accounts and/or roles and enabled MFA, it's recommendable to get some tooling support.

I love working with AWSume in this case.
It's easy to set up and really intuitive to work with.

awsu.me

{ 17/35 }
Access Denied ๐Ÿ™…โ€โ™‚๏ธ

Working with AWS, especially in the beginning, you'll face this message regularly.

Mostly, AWS' API will point you to missing permissions so you can easily extend your policy.

Sometimes it's not that easy and you'll need to get back to the docs.

{ 18/35 }
What you should not do: just extending your policy with all permissions for your target service by adding e.g. แด€แด„แด›ษชแดษด: ["dynamodb:*"] and ส€แด‡๊œฑแดแดœส€แด„แด‡: ["*"]

You won't learn anything by that and you're not respecting the rule of ๐™‡๐™š๐™–๐™จ๐™ฉ ๐™‹๐™ง๐™ž๐™ซ๐™ž๐™ก๐™š๐™œ๐™š

{ 19/35 }
๐™‡๐™š๐™–๐™จ๐™ฉ ๐™‹๐™ง๐™ž๐™ซ๐™ž๐™ก๐™š๐™œ๐™š states that you should always just assign the permissions that are actually needed for the service to fulfill its goals.

๐Ÿ’ก ๐™€๐™ญ๐™–๐™ข๐™ฅ๐™ก๐™š:
An app that runs on Lambda and now needs access to a recently created DynamoDB table.

{ 20/35 }
The easiest way would be to just create a policy that grants full permissions to DynamoDB and attach the role to your Lambdas role.

But that's not a good solution, because our app just needs to have read & write permissions for a single table.

{ 21/35 }
How can we improve?

1) Restricting actions
We don't manage tables, so we shouldn't grant ๐˜ฟ๐™š๐™ก๐™š๐™ฉ๐™š๐™๐™–๐™—๐™ก๐™š

What we need:
โ€ข ๐™Œ๐™ช๐™š๐™ง๐™ฎ
โ€ข ๐™‚๐™š๐™ฉ๐™„๐™ฉ๐™š๐™ข
โ€ข ๐™‹๐™ช๐™ฉ๐™„๐™ฉ๐™š๐™ข
โ€ข ๐™๐™ฅ๐™™๐™–๐™ฉ๐™š๐™„๐™ฉ๐™š๐™ข

You'll find all permissions in the docs!

docs.aws.amazon.com/service-authorโ€ฆ

{ 22/35 }
2) Restricting resources
As we're only working with a specific table, we can really fix the permissions to be only valid for this single table by listing the ARN.

arn:aws:dynamodb:๐™๐™€๐™‚๐™„๐™Š๐™‰:๐˜ผ๐˜พ๐˜พ๐™Š๐™๐™‰๐™_๐™„๐˜ฟ:table/๐™๐˜ผ๐˜ฝ๐™‡๐™€_๐™‰๐˜ผ๐™ˆ๐™€

Sounds complicated?

{ 23/35 }
For enforcing least privilege, you'll need to fiddle around with ARNs a lot.

Maybe this sounds tedious, but if you start working with ๐™„๐™ฃ๐™›๐™ง๐™–๐™จ๐™ฉ๐™ง๐™ช๐™˜๐™ฉ๐™ช๐™ง๐™š ๐™–๐™จ ๐˜พ๐™ค๐™™๐™š (IaC) tools like Terraform, CloudFormation, or AWS CDK, this is really easy & comfortable!

{ 24/35 }
Regardless of what you're using, all tools will create output variables for your created resources that include all the references you need, like for example the ARN.

You can create other resources that depend on those.

{ 25/35 }
That's not the end of IAMs capabilities.

AWS' ๐™‹๐™š๐™ง๐™ข๐™ž๐™จ๐™จ๐™ž๐™ค๐™ฃ ๐˜ฝ๐™ค๐™ช๐™ฃ๐™™๐™–๐™ง๐™ž๐™š๐™จ help you to restricted effective permissions for a user or role.

They also contain policies that describe actions and resources, but they are acting as an outer boundary.

{ 26/35 }
What it means: the actually attached permissions can never exceed the boundary!

So if your boundaries only list ๐™™๐™ฎ๐™ฃ๐™–๐™ข๐™ค๐™™๐™—:๐™Œ๐™ช๐™š๐™ง๐™ฎ for all resources, a role with ๐™™๐™ฎ๐™ฃ๐™–๐™ข๐™ค๐™™๐™—:* can't update or delete items, but only query!

What is it good for?

{ 27/35 }
Boundaries can be defined in one place but re-used across all of your account's roles and users.

By that, you could for example strictly separate an app's permissions to only access resources with a given name prefix, but having multiple apps within your account.

{ 28/35 }
You can also use your boundary policy not only as a boundary but as actual permissions, for example for your CI/CD service/tool like CodeBuild.

By that, you'll automatically grant all necessary rights, but still with respect to the boundary.

{ 29/35 }
Important details about boundaries policies:

โ€ข if used as a boundary, they are not actually granting permissions, but only restricting them!
โ€ข there's ๐™ฃ๐™ค ๐™š๐™›๐™›๐™š๐™˜๐™ฉ on resource-based policies, e.g. for your S3 bucket!

{ 30/35 }
There are a lot more features that IAM offers and this was just an introduction with some general recommendations, but it will be enough to get you started.

For following security best practices, there's also a lot of tooling you can fall back to!

{ 31/35 }
AWS offers its own service ๐™๐™ง๐™ช๐™จ๐™ฉ๐™š๐™™ ๐˜ผ๐™ซ๐™ž๐™จ๐™ค๐™ง

It reviews your permissions for unnecessary rights or best practice violations and checks that you've enabled AWS security features for your services and resources.

{ 32/35 }
Another great feature by AWS: its own ๐™‹๐™ค๐™ก๐™ž๐™˜๐™ฎ ๐™Ž๐™ž๐™ข๐™ช๐™ก๐™–๐™ฉ๐™ค๐™ง

It greatly helps to build, validate and troubleshoot your policies. It supports identity-based, resource-based and even Organizations service control policies.

policysim.aws.amazon.com

{ 33/35 }
There are a lot more third party services guiding you with security recommendations & well-architected tips like @thedashbird

๐˜ฟ๐™ž๐™จ๐™˜๐™ก๐™–๐™ž๐™ข๐™š๐™ง - I'm Dashbirds Developer Advocate ๐Ÿฅ‘ ๐Ÿ˜Š so this is biased, but we're happy to listen to your feedback for improvements!

{ 34/35 }
Some final words ๐Ÿ’ซ

Completely mastering IAM is more of a holy grail, as it's a complex topic and there will always be days where you're stuck on some permissions issue, regardless of your experience!

Don't be frustrated.
It gets easier with time.

{ 35/35 }
I hope you've enjoyed reading this thread and learned something new.

I'd be happy if you like or retweet the initial post! ๐Ÿ™Œ

If you have questions or need guidance on your cloud journey, follow me for regular content or send me a message ๐Ÿ“จ

Thanks for reading! ๐Ÿ’›

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Tobias Schmidt

Tobias Schmidt Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @tpschmidt_

19 Sep
๐Ÿ“š Cloud Concepts 1x1

What are SaaS, PaaS, IaaS and how do they differ?

A quick wrap-up ๐Ÿงต โ†“
As a DevOps engineer, you should know the most prominent types of concepts and what are the key differences.

Most likely you've already used several in your day-to-day work without being aware of it.
With XaaS, the general acronym is meant which includes all of the ...aaS solutions.

So this covers
โ€ข IaaS - Infrastructure as a Service
โ€ข PaaS - Platform as a Service
โ€ข SaaS - Software as a Service
to name the most famous ones.

Let's have a look at the details.
Read 8 tweets
7 Sep
My most received questions:
"How do I start my cloud engineering journey & what's the right path?"

There's not a single or correct path.
There are only recommendations.

A small recap of mine to get yourself going ๐Ÿงตโ†“
(1/7) Pick a cloud provider you're interested in:
ยท Amazon Web Service
ยท Microsoft Azure
ยท Google Cloud Platform

It doesn't matter which one you start with.
Even though they are completely different in some ways, a lot of your learnings will be transferable.
(2/7) Register yourself an account

Yes, you need a credit card, but you don't need to be scared of unexpected or exploding costs.
All of the providers are having a generous free tier, allowing you to test and explore their services.

Also, you can create budget alerts later on!
Read 8 tweets
6 Sep
Logs are an essential operational tool.

But they are only useful if you're able to make sense out of them.

Most important for that: using log levels consistently!
ยท โ„น๏ธ Trace
ยท ๐Ÿ’ก Debug
ยท โšช๏ธ Info
ยท ๐ŸŸ  Warn
ยท ๐Ÿ”ด๏ธ Error
ยท โšก๏ธ Fatal

A small thread about when to use what ๐Ÿงตโ†“
(1/7) โ„น๏ธ Trace

Your most verbose logs containing the most fine-grained information.
It gives you detailed insights into what's happening - not only in your code but also in third-party libraries.

Can go as far as documenting every step in a single algorithm.
(2/7) ๐Ÿ’ก Debug

Less information than 'trace' level, but still extended to a way that's needed to troubleshoot problems in detail.
Majorly used for pre-production/testing environments and often logs out sensitive information that can't be logged on production.
Read 8 tweets
4 Aug
AWS is used almost everywhere.
Knowing the fundamentals is therefore a high-value skill for every web developer.

Don't know where to begin?

A thread about some of its most famous services & related tutorials for starting your journey today! ๐Ÿงต๐Ÿ‘‡
(1/8) AWS offers great free tutorials on its own training site, ranging from beginner to expert levels.

You only need an Amazon account to get yourself started.
This thread will guide you to your first starting videos.

aws.training/LearningLibrary
(2/8) Amazon Elastic Compute Cloud (EC2)

EC2 provides computing capacity for all kinds of areas. Launch virtual instances and services in the blink of an eye & run your applications.

With AWS' free tier, you can run a t2 or t3 micro instance for free!

aws.training/Details/Video?โ€ฆ
Read 9 tweets
3 Aug
AWS is growing its number of services at a fast pace.

If we're counting namespaces, the statistics over the past decade are mind-boggling:
ยท 2013: 25
ยท 2015: 46
ยท 2017: 78
ยท 2019: 182

How to keep up with what's new?

A small thread about sources to keep you up-to-date ๐Ÿงต๐Ÿ‘‡
(1/4) The AWS News Blog

Guarantees to not miss out on new features or services, but also contains interesting statistics and other insights from AWS itself.
Gets updated very regularly, sometimes several times a day.

aws.amazon.com/blogs/aws/
(2/4) What's New with AWS?

If you're only focusing on keeping up with the new capabilities AWS provides, that's your major source.
You'll learn about small or big improvements to existing services, introductions of new ones as well as region expansions.

aws.amazon.com/new
Read 5 tweets
2 Aug
Scared of getting your hands on at AWS because you're in fear of unexpected costs for the cloud?

You don't have to be!

A small thread about steps you can take to sleep better on your journey to becoming an AWS expert ๐Ÿงต๐Ÿ‘‡
(1/6) AWS Free Tier #1

AWS grants you a lot of room for experiments for different services each month:
- 1m Lambda Requests
- 25 GB of DynamoDB storage
- 100 build minutes on CodeBuild
... and much more!

aws.amazon.com/free/
(2/6) AWS Free Tier#2

Even better: if you've recently created your account, you also have additional free limits for the next 12 months, including for example running a EC2 t2 or t3 micro instance without any costs.
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(