こちらでは初めまして、showkkoと申します。
で、この「20200110T064809Z」は何故か固定なんです。
timestr=urllib.parse.quote_plus(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")) sig_data="POST\ncloudformation.ap-northeast-1.amazonaws.com\n/\nAWSAccessKeyId="accessid"&Action=DescribeStackResources&SignatureMethod=HmacSHA256&SignatureVersion=2&StackName="stackname"&Timestamp="timestr"&Version=2010-05-15"
sig_seed=hmac.new(secretkey.encode("utf-8"),sig_data.encode("utf-8"),hashlib.sha256)
上記のようにグリニッジ標準時を取得して生成しており、少なくとも毎回「20200110T064809Z」という固定の日時で蹴られることはない筈なんですが…。 (変換前の文字列を出力して確認していますので、時間がおかしいことはない筈です。)
同様のコードでEC2ではうまくいきます。また、CloudFormationでも先週はうまくいっていました。 どなたか原因は想像つきますでしょうか?
生でAPIを呼ぶのをやめ、SDKを使うことで回避しました。
You are not logged in. Log in to post an answer.
A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.