我已阅读AWS IAM 示例策略,但没有看到允许组执行所有操作的示例。
我想:
{
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用。
有任何想法吗?
我正在尝试将用户限制为单个 VPC。我经历了控制对 Amazon VPC 资源的访问并提出了以下策略,但它不起作用。有人可以指出其中的错误吗?
我应该提到,在我在模拟设置中的条件键下设置 VPC ARN 后,IAM 策略模拟器似乎认为该策略很好。
(我已在我的策略中用实际值替换了区域、帐户和 vpc-id。)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:*Vpc*",
"ec2:*Subnet*",
"ec2:*Gateway*",
"ec2:*Vpn*",
"ec2:*Route*",
"ec2:*Address*",
"ec2:*SecurityGroup*",
"ec2:*NetworkAcl*",
"ec2:*DhcpOptions*",
"ec2:RunInstances",
"ec2:StopInstances",
"ec2:StartInstances",
"ec2:TerminateInstances",
"ec2:Describe*"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Vpc": "arn:aws:ec2:region:account:vpc/vpc-id"
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
谢谢。 我想创建一个 IAM 策略,允许用户按如下方式部署实例:
此场景在此处的 VPC 文档中得到解决(示例 4):
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_IAM.html#subnet-sg-example-iam
我已经尝试过我自己的策略版本:
{
"Version": "2012-10-17",
"Statement":[{
"Effect":"Allow",
"Action": "ec2:RunInstances",
"Resource": [
"arn:aws:ec2:eu-west-1:937821706121:image/ami-141ac363",
"arn:aws:ec2:eu-west-1:937821706121:subnet/subnet-733de516",
"arn:aws:ec2:eu-west-1:937821706121:network-interface/*",
"arn:aws:ec2:eu-west-1:937821706121:volume/*",
"arn:aws:ec2:eu-west-1:937821706121:key-pair/*",
"arn:aws:ec2:eu-west-1:937821706121:security-group/sg-4aa80f2f"
]
}]
}
Run Code Online (Sandbox Code Playgroud)
它不起作用。当我尝试以应用此策略的组成员的用户身份部署实例时,我的权限被拒绝。我是否需要包含其他一些策略以允许以这种方式部署实例?
我正在尝试将一些文件从私有 s3 存储桶检索到文件系统位置弹性 beantalk ec2 实例,但没有成功。
我创建了一个名为的存储桶,dev-config其中包含一个名为local.properties.
我创建了一个 IAM 策略
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::dev-config",
"arn:aws:s3:::dev-config/*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
并将该策略与 IAM 角色相关联,该角色又与 EC2 实例相关联。我已经确认我可以使用 aws-cli 从 s3 存储桶中获取文件,而无需提供任何额外的凭据。即 aws s3 ls s3://dev-config/local.properties
在我的项目中,我添加了以下文件:
.ebextensions/01_files.config
"/usr/share/tomcat7/lib/local.properties" :
mode: "000777"
owner: ec2-user
group: ec2-user
source: http://s3.amazonaws.com/dev-config/local.properties
Run Code Online (Sandbox Code Playgroud)
我还尝试了源网址的一些变体
source: http://dev-config.s3.amazonaws.com/dev-config/local.properties
source: http://dev-config.s3.amazonaws.com/local.properties
source: s3://dev-config/local.properties
Run Code Online (Sandbox Code Playgroud)
而且我也尝试添加一个authentication属性但没有成功(似乎没有关于可能的身份验证值的文档)。身份验证:S3Access
到目前为止,这些方法都没有奏效。
在某些情况下,我会在日志中收到拒绝访问的消息:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message>
<RequestId>blahblah</RequestId>
<HostId>blahblah</HostId>
</Error>
Run Code Online (Sandbox Code Playgroud)
在其他情况下,我在 local.properties 文件本身中有错误消息 …
有许多我无法控制的 AWS 账户。我已经让账户所有者将 IAM 角色 , 部署TrustingSecurityAuditor到他们的账户中,这授予了TrustingSecurityAuditor在我的 AWS 账户中担任不同 IAM 角色的角色的权利TrustedSecurityAuditor。(关于委派访问的文档)
这非常有效,并允许我和我的安全团队为公司中的其他账户持有人提供安全审计服务。为此,我们启动了一个具有TrustedSecurityAuditorIAM 角色的 ec2 实例,我们的代码通过对每个账户的角色执行 an来使用STS从每个账户请求临时凭证。AssumeRoleTrustingSecurityAuditor
现在我想在我的账户中创建一个在不同 ec2 实例上运行的附加服务,它不仅可以承担这些“信任”账户的角色,还可以在我的账户中做其他事情,比如访问我账户的 DynamoDB 来存储信息。
如果我将该TrustedSecurityAuditor角色应用到实例,则我没有所需的本地权限(如 DynamoDB 访问权限)。
我不能将多个 IAM 角色应用于一个实例(除非我弄错了)。
当我尝试创建一个新角色时MyNewService,使用 DynamoDB 访问可以访问AssumeRole该TrustedSecurityAuditor角色,希望然后使用这些 STS 凭据对外部帐户中AssumeRole的TrustingSecurityAuditor角色进行第二次操作,我遇到了这个问题:
我能够AssumeRole从MyNewService角色到TrustedSecurityAuditor角色,但是当我做第二AssumeRole的TrustingSecurityAuditor角色AWS返回错误
用户:arn:aws:sts::123456789012:assumed-role/TrustedSecurityAuditor/MyNewService 无权执行:sts:AssumeRole 资源:arn:aws:iam::123456789012:role/TrustingSecurityAuditor
这样做的原因是“用户”尝试的AssumeRole是
arn:aws:sts::123456789012:assumed-role/TrustedSecurityAuditor/MyNewService
不是
arn:aws:sts::123456789012:assumed-role/TrustedSecurityAuditor
这意味着您不能链接您的AssumeRole …
Get-EC2Instance从 EC2 实例调用并获取
Get-EC2Instance : You are not authorized to perform this operation.
Run Code Online (Sandbox Code Playgroud)
我需要将哪个 IAM 操作添加到我的策略中?
我继承了一个 Amazon AWS 环境,在该环境中,Root 帐户密钥已被广泛分发,以便备份到 S3 存储桶。
我需要追踪密钥的使用位置,以便我可以用权限有限的密钥替换它。
我在存储桶上设置了事件通知,以将消息发送到 SQS Q 以告诉我何时创建对象。这些消息包含发起对象请求的服务器的 IP 地址,但不包含使用中的 IAM 密钥(仅包含使用中的亚马逊账户的 ID)。
Cloudtrail 在这里也没有用,因为 S3 请求不会写入 Cloudtrail。
有没有其他方法可以告诉我在发出 S3 请求时正在使用哪个密钥?
请注意,这不是建议的解决方案,只是对我所做工作的更新。使用上面建议的方法。我应该更新问题。
#感谢 EEAA
我考虑过,但是有数百个桶在起作用,所以这不太实用。我希望 IAM 中的某个地方可以跟踪密钥使用情况。
鉴于我已经设置了事件和 SQS,我最终要做的是在可能的存储桶上设置事件,并将 S3 事件时间戳与 IAM 上次使用的键时间戳提供的时间戳相匹配。
这为我提供了在使用根密钥的同时向 S3 发送请求的服务器的 IP 地址,从中我能够在几台服务器上找到根密钥。希望当我在接下来的几天检查根密钥时,我将不再看到它在使用中。
如果没有,我可能必须按照您的建议在单个存储桶上设置日志记录。
我有一个 IAM 策略设置,我认为它提供了将新版本部署到 Elastic Beanstalk 应用程序的正确权限。我仍然得到InsufficientPrivilegesException,特别是:
aws elasticbeanstalk update-environment --environment-name LearnTfsBff --version-label LearnTfsBff-30
Run Code Online (Sandbox Code Playgroud)
调用 UpdateEnvironment 操作时发生错误 (InsufficientPrivilegesException):拒绝访问
这是为部署用户设置的策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"autoscaling:*",
"cloudformation:GetTemplate",
"cloudformation:DescribeStackResource",
"cloudformation:DescribeStackResources",
"autoscaling:*",
"cloudfront:CreateInvalidation",
"ec2:describeVpcs",
"ec2:DescribeImages",
"elasticbeanstalk:CreateApplicationVersion",
"elasticbeanstalk:DescribeApplications",
"elasticbeanstalk:DescribeApplicationVersions",
"elasticbeanstalk:DescribeEnvironments",
"elasticbeanstalk:UpdateEnvironment",
"elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
"elasticloadbalancing:DescribeInstanceHealth",
"elasticloadbalancing:RegisterInstancesWithLoadBalancer",
"s3:ListAllMyBuckets",
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::learn-tfs-builds"
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "arn:aws:s3:::learn-tfs-*"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我尝试添加"elasticbeanstalk:*"为允许的操作,但没有解决权限问题。我添加"*"了允许并且确实解决了它,但不是一个允许的解决方案。
如何调试 …
我已通过 AWS Cloud 9 创建了 Lambda Python 函数,但在尝试从 Lambda 函数写入 S3 存储桶时遇到了问题。当我在 Cloud 9 中测试时,Python 代码运行良好并完美写入 S3 存储桶。当我将其推送到 Lambda 函数并且它运行时,我认为会出现错误。这让我认为 5 月 9 日运行应用程序的角色与 Lambda 函数运行时的角色之间存在不同的权限。
给出了以下错误,我正在寻找一些关于我可能缺少的内容的建议,在错误下方我描述了设置:
[ERROR] ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
Traceback (most recent call last):
File "/var/task/index.py", line 22, in handler
s3.Bucket(bucket_name).put_object(Key=s3_path, Body=encoded_string)
File "/var/runtime/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)
File "/var/runtime/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/var/runtime/botocore/client.py", line 320, in _api_call …Run Code Online (Sandbox Code Playgroud) 我有一个网站,用户需要登录。他们可以上传和删除自己的图片,但这些图片应该是私人的,所以图片没有设置为任何人都可以查看的公开。
我知道我们可以使用 IAM 策略将 S3 存储桶中不同文件夹的访问权限限制为不同的 IAM 用户。但是网站用户只是数据库中记录的普通注册用户(可能是MySQL),他们不是IAM用户。
在不需要每个网站用户的 IAM 用户的情况下进行设置的逻辑是什么?有什么好的例子可以推荐吗?或者我想太多了,有更简单的方法来设置这种限制?
在此先感谢您的任何建议。