ようへいの日々精進XP

よかろうもん

2018 年 08 月 19 日 (日)

ジョギング

  • 香椎浜 x 2 周
  • ゆっくりとダラッと走った

日課

  • 引き続き, 腰と腰に痛みがあるので休み中

次の住処を決めてきた

  • 今度は, 奥さん待望のちょっと広めの部屋
  • 引っ越しは来月というタイトなスケジュールだけど無理せず頑張ろう

今日の AWS ~ AWS 認定デベロッパー – アソシエイトレベルサンプル試験を解く (4) ~

公開されているサンプル試験問題を解く. なぜ, その答えになるのかをちゃんと理解する必要がある. 尚, 今回は英語版のサンプル問題である為, 翻訳には Google 翻訳を利用している.

Q1. CloudFormation 展開時のエラー

設問

1) Your CloudFormation template launches a two-tier web application in us-east-1. When you attempt to create a development stack in us-west-1, the process fails.

  • 二層の Web アプリケーションを us-east-1 に CloudFormation を利用して展開しようとしている
  • このテンプレートを us-west-1 で展開しようとすると失敗する

What could be the problem?

A) The AMIs referenced in the template are not available in us-west-1.
B) The IAM roles referenced in the template are not valid in us-west-1.
C) Two ELB Classic Load Balancers cannot have the same Name tag.
D) CloudFormation templates can be launched only in a single region.

何が問題なのか.

A) テンプレートで参照されている AMI は us-west-1 では使用できない
B) テンプレートで参照されている IAM ロールは us-west-1 では無効である
C) 2 つの ELB クラシックロードバランサは同じ名前タグを持つことが出来ない
D) CloudFormation テンプレートは、単一の領域でのみ起動出来る

正答

A) The AMIs referenced in the template are not available in us-west-1. (テンプレートで参照されている AMI は us-west-1 では使用できない)

メモ

解答のコメントより引用.

AMIs are stored in a region and cannot be accessed in other regions. To use the AMI in another region, you must copy it to that region. IAM roles are valid across the entire account.

  • AMI はリージョン毎に格納され, 他のリージョンからアクセス出来ない
  • 別のリージョンで利用する場合には AMI をコピーする必要がある
  • IAM ロールはアカウント全体で有効となる

Q2. SQS の仕様

設問

Your application reads commands from an SQS queue and sends them to web services hosted by your partners. When a partner's endpoint goes down, your application continually returns their commands to the queue. The repeated attempts to deliver these commands use up resources. Commands that can’t be delivered must not be lost.

  • アプリケーションは SQS キューからコマンドを読み取り, パートナーがホストする Web サービスにコマンドを送信する
  • パートナーの Web サービスが停止した場合, アプリケーションはコマンドをキューに継続的に送信してしまう
  • 継続的に送信するとリソースが消費されてしまう
  • 配信されなかったコマンドは失われてはいけない

How can you accommodate the partners' broken web services without wasting your resources?

A) Create a delay queue and set DelaySeconds to 30 seconds.
B) Requeue the message with a VisibilityTimeout of 30 seconds.
C) Create a dead letter queue and set the Maximum Receives to 3.
D) Requeue the message with a DelaySeconds of 30 seconds.

リソースを浪費することなく, 停止されるパートナーの Web サービスに対してどのように対応できるか?

A) 遅延キューを作成し, DelaySeconds を 30 秒に設定します
B) 30 秒の VisibilityTimeout でメッセージを再キューします
C) デッドレターキューを作成し, 最大受信数を 3 に設定します
D) 30 秒の DelaySeconds でメッセージを再キューします

正答

なんだろう...このような場合には Long Polling が有効のような気がするけど...

C) Create a dead letter queue and set the Maximum Receives to 3. (デッドレターキューを作成し, 最大受信数を 3 に設定します)

メモ

解答のコメントより引用.

After a message is taken from the queue and returned for the maximum number of retries, it is automatically sent to a dead letter queue, if one has been configured. It stays there until you retrieve it for forensic purposes.

  • デッドレターキューが設定されている場合, メッセージ取得の最大試行回数を超えると, 自動的にデッドレターキューに送信される
  • forensic purposes = 法医学って訳されるので, ちょっとここはよく意味が分からない

設問に「配信されなかったコマンドは失われてはいけない」とあるので, デッドレターキューを設定し, 正常に処理出来なかったメッセージを後から処理出来るようにしておく必要があるということかな.

Q3. 安全に SQS にデータを書き込む為に必要な AWS の資格情報をどのように管理するか的な

設問

Your application must write to an SQS queue. Your corporate security policies require that AWS credentials are always encrypted and are rotated at least once a week.

  • アプリケーションは SQS キューにメッセージを書き込む必要がある
  • 企業のセキュリティポリシーでは, AWS 資格情報は常に暗号化され, 少なくとも1週間に1回ローテーションされる

How can you securely provide credentials that allow your application to write to the queue?

A) Have the application fetch an access key from an Amazon S3 bucket at run time.
B) Launch the application's Amazon EC2 instance with an IAM role.
C) Encrypt an access key in the application source code.
D) Enroll the instance in an Active Directory domain and use AD authentication.

アプリケーションがキューに書き込むための資格情報を安全に提供するにはどうすればよいか?

A) 実行時にアプリケーションが Amazon S3 バケットからアクセスキーをフェッチするようにします.
B) IAM Role が付与された Amazon EC2 インスタンスでアプリケーションを起動します.
C) アプリケーションソースコード内のアクセスキーを暗号化します.
D) インスタンスを Active Directory ドメインに登録し, AD 認証を使用します.

正答

B) Launch the application's Amazon EC2 instance with an IAM role. (IAM Role が付与された Amazon EC2 インスタンスでアプリケーションを起動します.)

メモ

解答のコメントより引用.

IAM roles are based on temporary security tokens, so they are rotated automatically. Keys in the source code cannot be rotated (and are a very bad idea). It’s impossible to retrieve credentials from an S3 bucket if you don’t already have credentials for that bucket. Active Directory authorization will not grant access to AWS resources.

  • IAM ロールは一時的なセキュリティトークンに基づいている為, 自動的にローテーションされる
  • ソースコード内のキーはローテーション出来ない (とても悪い実装である)
  • S3 バケットへの資格情報がない場合, S3 バケットから資格情報を取得することは不可能である
  • Active Directory の承認は, AWS リソースへのアクセスを許可しない (そりゃそうだ...)

フムフム.