Real-time use case of launching a specific instance using CloudFormation
This is one of the requirements that most of us face in a non-production or development environment, where we want to restrict users to launching specific instance types to save costs. Let's learn how to achieve this with the help of an IAM policy. We are going to look at a real-time use case for an IAM policy where we must do the following:
- First, we need to create two IAM users,
plakheraprod
andplakheradev
. - Next, we must create an IAM group called
EC2LimitedAccess
. - Now, we must create an IAM policy that restricts a user to performing only specific actions (
RunInstances
,StopInstances
, andStartInstances
), as well as launching only specific instance types (t2.small
andt2.medium
).
With that in mind, let's start creating the stack template:
- Create a file named
iam-resource-creation.yml
. You can find it here: https://github.com/PacktPublishing/AWS-for-System-Administrators...