1. 程式人生 > >Use IAM Tags to Restrict EC2 Instances or EBS Volumes

Use IAM Tags to Restrict EC2 Instances or EBS Volumes

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowToDescribeAll",
            "Effect": "Allow",
            "Action": [
                "ec2:Describe*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowRunInstances",
            "Effect": "Allow",
            "Action": "ec2:RunInstances",
            "Resource": [
                "arn:aws:ec2:*::image/*",
                "arn:aws:ec2:*::snapshot/*",
                "arn:aws:ec2:*:*:subnet/*",
                "arn:aws:ec2:*:*:network-interface/*",
                "arn:aws:ec2:*:*:security-group/*",
                "arn:aws:ec2:*:*:key-pair/*"
            ]
        },
        {
            "Sid": "AllowRunInstancesWithRestrictions",
            "Effect": "Allow",
            "Action": [
                "ec2:CreateVolume",
                "ec2:RunInstances"
            ],
            "Resource": [
                "arn:aws:ec2:*:*:volume/*",
                "arn:aws:ec2:*:*:instance/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:RequestTag/key1": "value1",
                    "aws:RequestTag/key2": "value2"
                },
                "ForAllValues:StringEquals": {
                    "aws:TagKeys": [
                        "key1",
                        "key2"
                    ]
                }
            }
        },
        {
            "Sid": "AllowCreateTagsOnlyLaunching",
            "Effect": "Allow",
            "Action": [
                "ec2:CreateTags"
            ],
            "Resource": [
                "arn:aws:ec2:*:*:volume/*",
                "arn:aws:ec2:*:*:instance/*"
            ],
            "Condition": {
                "StringEquals": {
                    "ec2:CreateAction": "RunInstances"
                }
            }
        }
    ]
}

相關推薦

Use IAM Tags to Restrict EC2 Instances or EBS Volumes

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowToDescribeAll", "Effect": "Allow",

Use IAM Roles to Restrict API Calls from Specific IP Addresses

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:user/&

Restrict Access to Launch EC2 Instances from Only Tagged AMIs

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ReadOnlyAccess", "Effect": "Allow", "Act

Use IAM Policies to Grant Access to User

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowUserToSeeBucketListInTheConsole", "Action": [

Assign an IAM Role to an EC2 Instance

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

Amazon brings predictive scaling to EC2 instances

Amazon Web Services this week is improving its Auto Scaling tool with machine learning, giving it predictive capabilities. The new predictive scaling featu

Ask HN: Do you use digital ink to create handwritten notes? Why or why not?

No, because I don't have a tablet. But even if I did, still probably not because sometimes it's easier to flip through notebook pages th

Use CloudFront Geo Restriction To Restrict Access From Geographic Regions

You can use the geo restriction feature, also known as geoblocking, to prevent users in specific geographic locations from accessing content th

Use EC2Rescue to Troubleshoot EC2 Windows Issues

EC2Rescue for EC2 Windows is a convenient, straightforward, GUI-based troubleshooting tool that can be run on your Amazon EC2 Windows Server in

Restrict Access of Users to Specific EC2 Resources

{ "Version": "2012-10-17", "Statement": [ { "Action": [ "ec2:StartInstances", "ec2:S

Use Swap File to Allocate Memory as Swap Space in Amazon EC2 Instance

Swap space is commonly used as a short-term replacement for physical RAM on an Amazon EC2 instance that's experiencing demand for physical RAM

Resolve "Server Refused Our Key" Errors When Connecting to EC2 Instances

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

Recover Access to EC2 Instances After Losing SSH Key Pair

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

Facing Load Balancer to EC2 Instances with Private IP Addresses

You must create public subnets in the same Availability Zones as the private subnets that are used by your private instances. Then associate th

Resolve Issues with Corrupt or Missing Network Drivers on Windows EC2 Instances

reg load HKLM\AWSTempSoftware D:\Windows\System32\config\SOFTWARE reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_S

UDP Traffic to EC2 Instances

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

Seamlessly Join EC2 Instances to a Domain

Way back in 2008 I announced that you could run Microsoft Windows on Amazon EC2. Since that time, we have made many additions to the initial offer

New – Amazon EC2 Instances with Up to 8 NVIDIA Tesla V100 GPUs (P3)

Driven by customer demand and made possible by on-going advances in the state-of-the-art, we’ve come a long way since the original m1.small instan

[Nuxt] Use Vuex Actions to Delete Data from APIs in Nuxt and Vue.js

export begin async delet tin remove todo ras alt You‘ll begin to notice as you build out your actions in Vuex, many of them will look qui