如何解决如何为Amazon S3对象预签名URL,并使其在一周后过期?
根据guide,我已经指定了IAM用户凭证(访问密钥和秘密访问密钥),并使用如下所示的AWS Signature版本4生成了预签名的URL:
import random
def snakeEyes():
# Simulate dice
# Variables to store integers
diceCount = 0
diceSum = 0
while(diceSum != 2):
dice1 = random.randint(1,6)
dice2 = random.randint(1,6)
diceSum = dice1 + dice2
diceCount = diceCount + 1
# if both 1's - snake eyes
if diceSum == 2:
combo_name = "snake eyes"
# if both 6's - Boxcars
elif diceSum == 12:
combo_name = "Boxcars"
# if 7 --> natural
elif diceSum == 7:
combo_name = "natural"
# if sum % 2 == 0 -- we got an even
# if dice values are same -- "hard"
# else - easy
# turn the sum number into text number
elif diceSum % 2 == 0:
if dice1 == dice2:
combo_name = "hard " + str(diceSum)
else:
combo_name = "easy " + str(diceSum)
# else - have an odd number
# figure out which odd name we are using
else:
if diceSum == 3:
combo_name = "ace deuce"
elif diceSum == 5:
combo_name = "fever five"
elif diceSum == 9:
combo_name = "nina"
elif diceSum == 11:
combo_name = "yo-leven"
# Print line with dice values and names
print("Dice1: " + str(dice1) + " Dice 2: " + str(dice2) + " " + combo_name)
print("The dice rolled " + str(diceCount) + " times before it got snake eyes.")
snakeEyes()
但是,该网址在6小时后仍然过期。我的代码有什么错误吗?或者我使用的证书不属于IAM用户吗?如何检查凭证类型(IAM用户或AWS IAM实例配置文件)?我只是遵循the steps来获取我的访问密钥和秘密访问密钥
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。