Politicas para EC2
This commit is contained in:
parent
9a4b4d3365
commit
65b201bf51
15
EC2/accesoEC2AZ.json
Normal file
15
EC2/accesoEC2AZ.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": "ec2:*",
|
||||
"Resource": "*",
|
||||
"Effect": "Allow",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"ec2:Region": "us-east-2"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
42
EC2/adminGruposSeg.json
Normal file
42
EC2/adminGruposSeg.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:DescribeSecurityGroups",
|
||||
"ec2:DescribeSecurityGroupRules",
|
||||
"ec2:DescribeTags"
|
||||
],
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:AuthorizeSecurityGroupIngress",
|
||||
"ec2:RevokeSecurityGroupIngress",
|
||||
"ec2:AuthorizeSecurityGroupEgress",
|
||||
"ec2:RevokeSecurityGroupEgress",
|
||||
"ec2:ModifySecurityGroupRules",
|
||||
"ec2:UpdateSecurityGroupRuleDescriptionsIngress",
|
||||
"ec2:UpdateSecurityGroupRuleDescriptionsEgress"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:ec2:region:111122223333:security-group/*"
|
||||
],
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"aws:ResourceTag/Department": "Test"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:ModifySecurityGroupRules"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:ec2:region:111122223333:security-group-rule/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
27
EC2/asociarODisociarEBSetiquetas.json
Normal file
27
EC2/asociarODisociarEBSetiquetas.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:AttachVolume",
|
||||
"ec2:DetachVolume"
|
||||
],
|
||||
"Resource": "arn:aws:ec2:*:*:instance/*",
|
||||
"Condition": {
|
||||
"StringEquals": {"aws:ResourceTag/Department": "Development"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:AttachVolume",
|
||||
"ec2:DetachVolume"
|
||||
],
|
||||
"Resource": "arn:aws:ec2:*:*:volume/*",
|
||||
"Condition": {
|
||||
"StringEquals": {"aws:ResourceTag/VolumeUser": "${aws:username}"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
19
EC2/asociarODisociarVolumen.json
Normal file
19
EC2/asociarODisociarVolumen.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:AttachVolume",
|
||||
"ec2:DetachVolume"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:ec2:*:*:volume/*",
|
||||
"arn:aws:ec2:*:*:instance/*"
|
||||
],
|
||||
"Condition": {
|
||||
"ArnEquals": {"ec2:SourceInstanceARN": "arn:aws:ec2:*:*:instance/instance-id"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
23
EC2/iniciarDetenerEC2.json
Normal file
23
EC2/iniciarDetenerEC2.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:StartInstances",
|
||||
"ec2:StopInstances"
|
||||
],
|
||||
"Resource": "arn:aws:ec2:*:*:instance/*",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"aws:ResourceTag/Owner": "${aws:username}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": "ec2:DescribeInstances",
|
||||
"Resource": "*"
|
||||
}
|
||||
]
|
||||
}
|
20
EC2/iniciarDetenerEC2Etiquetas.json
Normal file
20
EC2/iniciarDetenerEC2Etiquetas.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "StartStopIfTags",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:StartInstances",
|
||||
"ec2:StopInstances"
|
||||
],
|
||||
"Resource": "arn:aws:ec2:region:account-id:instance/*",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"aws:ResourceTag/Project": "DataAnalytics",
|
||||
"aws:PrincipalTag/Department": "Data"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
13
EC2/iniciarDetenerEC2EtiquetasYCoincidencias.json
Normal file
13
EC2/iniciarDetenerEC2EtiquetasYCoincidencias.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": {
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:startInstances",
|
||||
"ec2:stopInstances"
|
||||
],
|
||||
"Resource": "*",
|
||||
"Condition": {"StringEquals":
|
||||
{"aws:ResourceTag/CostCenter": "${aws:PrincipalTag/CostCenter}"}}
|
||||
}
|
||||
}
|
30
EC2/iniciarDetenerEC2ModifGrupoSeg.json
Normal file
30
EC2/iniciarDetenerEC2ModifGrupoSeg.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeInstances",
|
||||
"ec2:DescribeSecurityGroups",
|
||||
"ec2:DescribeSecurityGroupReferences",
|
||||
"ec2:DescribeStaleSecurityGroups"
|
||||
],
|
||||
"Resource": "*",
|
||||
"Effect": "Allow"
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"ec2:AuthorizeSecurityGroupEgress",
|
||||
"ec2:AuthorizeSecurityGroupIngress",
|
||||
"ec2:RevokeSecurityGroupEgress",
|
||||
"ec2:RevokeSecurityGroupIngress",
|
||||
"ec2:StartInstances",
|
||||
"ec2:StopInstances"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:ec2:*:*:instance/i-instance-id",
|
||||
"arn:aws:ec2:*:*:security-group/sg-security-group-id"
|
||||
],
|
||||
"Effect": "Allow"
|
||||
}
|
||||
]
|
||||
}
|
26
EC2/lanzarEC2SubredProgramaticaConsola.json
Normal file
26
EC2/lanzarEC2SubredProgramaticaConsola.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:Describe*",
|
||||
"ec2:GetConsole*"
|
||||
],
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": "ec2:RunInstances",
|
||||
"Resource": [
|
||||
"arn:aws:ec2:*:*:subnet/subnet-subnet-id",
|
||||
"arn:aws:ec2:*:*:network-interface/*",
|
||||
"arn:aws:ec2:*:*:instance/*",
|
||||
"arn:aws:ec2:*:*:volume/*",
|
||||
"arn:aws:ec2:*::image/ami-*",
|
||||
"arn:aws:ec2:*:*:key-pair/*",
|
||||
"arn:aws:ec2:*:*:security-group/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
23
EC2/limitEC2enRangoIP.json
Normal file
23
EC2/limitEC2enRangoIP.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["ec2:TerminateInstances"],
|
||||
"Resource": ["*"]
|
||||
},
|
||||
{
|
||||
"Effect": "Deny",
|
||||
"Action": ["ec2:TerminateInstances"],
|
||||
"Condition": {
|
||||
"NotIpAddress": {
|
||||
"aws:SourceIp": [
|
||||
"192.0.2.0/24",
|
||||
"203.0.113.0/24"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Resource": ["*"]
|
||||
}
|
||||
]
|
||||
}
|
23
EC2/requerirMFAoperarEC2.json
Normal file
23
EC2/requerirMFAoperarEC2.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "AllowAllActionsForEC2",
|
||||
"Effect": "Allow",
|
||||
"Action": "ec2:*",
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "DenyStopAndTerminateWhenMFAIsNotPresent",
|
||||
"Effect": "Deny",
|
||||
"Action": [
|
||||
"ec2:StopInstances",
|
||||
"ec2:TerminateInstances"
|
||||
],
|
||||
"Resource": "*",
|
||||
"Condition": {
|
||||
"BoolIfExists": {"aws:MultiFactorAuthPresent": false}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user