<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AWS &#8211; mirai</title>
	<atom:link href="https://origin.mirai006.com/category/mega-cloud/aws/feed" rel="self" type="application/rss+xml" />
	<link>https://origin.mirai006.com</link>
	<description>みらいへ</description>
	<lastBuildDate>Sun, 25 Apr 2021 06:27:28 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.5</generator>
	<item>
		<title>Let&#8217;s Encrypt の証明書 入れ替えでエラーになる</title>
		<link>https://origin.mirai006.com/2021/04/25/1150</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 25 Apr 2021 06:27:28 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1150</guid>

					<description><![CDATA[このWordPressの更新するサイトの証明書はLet&#8217;s　Encryptで取得しているのですが､下記のエラーを履くようになりました｡ ちゃんと読んでなかったので､これは証明書変更ができない!!どうしようと焦 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>このWordPressの更新するサイトの証明書はLet&#8217;s　Encryptで取得しているのですが､下記のエラーを履くようになりました｡</p>



<pre class="wp-block-code"><code>Your system is not supported by certbot-auto anymore.
certbot-auto and its Certbot installation will no longer receive updates.
You will not receive any bug fixes including those fixing server compatibility
or security problems.
Please visit https://certbot.eff.org/ to check for other alternatives.</code></pre>



<p>ちゃんと読んでなかったので､これは証明書変更ができない!!どうしようと焦っていました｡</p>



<p>いろいろ調べると､Certbot-autoの導入をGitHubからしているとこのメッセージがでるようです｡解決さくとしては､Snapdから取得しなさいということでした｡</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-hatena-blog wp-block-embed-hatena-blog"><div class="wp-block-embed__wrapper">
<iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" title="AmazonLinux2 に snapd を入れて certbot による証明書自動更新生活を満喫する - ARCHIVESDRIVE HB" src="https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdonbulinux.hatenablog.jp%2Fentry%2F2021%2F02%2F25%2F005721#?secret=JOJhhW4EZJ" data-secret="JOJhhW4EZJ" scrolling="no" frameborder="0"></iframe>
</div></figure>



<p>このページをみながら､実施していたけど､2回目のInstalling snapdのところでエラー｡エラー内容は､https://people.canonical.com/~mvo/snapd/amazon-linux2/repo/aarch64がない｡｡｡うぅん?といろいろ調べているなか､このサーバをt4g.microで作ったことを思い出しました｡サーバ見てもない｡まだ､来ていないとのことか｡</p>



<p>ちょっとパッケージを他のものから持ってくればいいはずなんだけど､ちょっと沼っぽいので､証明書は今の所､新しいものが入っているので､このままで放置したいと思います｡</p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>AWS ユーザ関連の見直し</title>
		<link>https://origin.mirai006.com/2021/04/25/1148</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 25 Apr 2021 04:43:47 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1148</guid>

					<description><![CDATA[AWSのIAMの見直しをしました｡ やったことは､ユーザからAWSのリソースを変更する権限を削除して､Roleに書き込み､Switch Roleするように変更しました｡ CLI実行のためAccess key接続をする､ユ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>AWSのIAMの見直しをしました｡</p>



<p>やったことは､ユーザからAWSのリソースを変更する権限を削除して､Roleに書き込み､Switch Roleするように変更しました｡</p>



<p>CLI実行のためAccess key接続をする､ユーザを作ろうと思っていました｡</p>



<p>CLIではEC2の起動停止をしたかったのですが､起動停止してよいかどうかをEC2のTagの設定を見て実施できるようにしたいと思いました｡その再EC2のタグを参照できるようにするため､ec2:DescribeInstancesの権限を与えないといけないことがわかりました｡この権限を与えてしまうと､EC2のインスタンスIDを知られてしまうので､この権限付きのAccess Key接続ユーザを作りたくないと思いました｡</p>



<p>なので､認証と認可をわけるため､認可部分であるRoleをユーザ認証から分離するようにしました｡</p>



<p>どうせやるなら､ということで､普段ログインしているアカウントにも実施しました｡私は､U2Fのデバイスでログインしているので､デバイスごとのユーザを作って､それぞれSwitch Roleするようにしました｡CFnで作成したので､これからはCFnで管理していこうと思っています｡</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ADSLから光に変えて</title>
		<link>https://origin.mirai006.com/2021/04/25/1146</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 25 Apr 2021 04:05:53 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1146</guid>

					<description><![CDATA[ADSLを引いていた頃はIP Adressが変わることはなかったのですが､光に変えてから､IP Adressが頻繁に変わるようになりました｡固定IPを選択していないので､仕方がないのですが｡｡｡ 今日は久しぶりにEC2の [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>ADSLを引いていた頃はIP Adressが変わることはなかったのですが､光に変えてから､IP Adressが頻繁に変わるようになりました｡固定IPを選択していないので､仕方がないのですが｡｡｡</p>



<p>今日は久しぶりにEC2のメンテナンスでSSHしたのですが､何故か｡｡｡｡つながらない｡</p>



<p>そうです､Security Groupに登録しているIP Adressが変わったため､接続できませんでした｡ちょっとこのあたり､見直してみたいと思います｡</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>このサイトのリファクタ</title>
		<link>https://origin.mirai006.com/2021/04/25/1144</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 25 Apr 2021 04:00:22 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[mirai - LifeHack]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1144</guid>

					<description><![CDATA[新しい部署に異動して､インフラのコード化というものを勉強しています｡ このサイトは2､3年前に作った以来､エラーもなく動作しているので､リファクタをしていなかったのですが､データベースの破壊とか､なにかあったときに備えて [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>新しい部署に異動して､インフラのコード化というものを勉強しています｡</p>



<p>このサイトは2､3年前に作った以来､エラーもなく動作しているので､リファクタをしていなかったのですが､データベースの破壊とか､なにかあったときに備えて､コード化をしたいと思います｡</p>



<p>AWSのリソースはそれなりにCFnになっているので､そこから､AnsibleでWordpressまで作るところをやっていきたいと思います｡</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>AWSとAzureをVPN接続する</title>
		<link>https://origin.mirai006.com/2020/10/21/1105</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Wed, 21 Oct 2020 09:33:47 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1105</guid>

					<description><![CDATA[業務でAWSとAzureを接続する必要がありそうだったので、調査しました。 調査といっても、作成するための手順は下記のページにあるので、そちらを参考にしてください。 https://level69.net/archive [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>業務でAWSとAzureを接続する必要がありそうだったので、調査しました。</p>



<p>調査といっても、作成するための手順は下記のページにあるので、そちらを参考にしてください。</p>



<p><a href="https://level69.net/archives/26362">https://level69.net/archives/26362</a></p>



<p><a href="https://dev.classmethod.jp/articles/site_vpn_azure_aws/#toc-2">https://dev.classmethod.jp/articles/site_vpn_azure_aws/#toc-2</a></p>



<p>どちらのページも完成度が高く、両方参考にしながら、作成することができました。なので、手順は載せないのですが、それぞれのリソースの役割を記載してみようと思います。</p>



<p class="has-medium-font-size"><strong>AWS</strong></p>



<p>Virtual Private Gateway : AWS側の接続設定<br>Customer Gateway : 接続先IPの管理<br>Site-to-Site VPN Connections : AWS側のIP、Pre-Shared keyの管理、接続先のRoute情報</p>



<p class="has-medium-font-size">Azure</p>



<p>仮想ネットワークゲートウェイ : Azure側の接続設定<br>ローカルネットワークゲートウェイ : 接続先のIPの管理<br>ローカルネットワークゲートウェイの接続 :接続先のPre-Shared key、接続先Route情報の管理</p>



<p>絵で表現すると下記の通り。</p>



<figure class="wp-block-image size-large"><img width="1024" height="563" src="https://origin.mirai006.com/wp-content/uploads/2020/10/image-19-1024x563.png" alt="" class="wp-image-1106" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-19-1024x563.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-19-300x165.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-19-768x422.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-19.png 1385w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>これを理解し、AWSの1つのVCPとAzureの二つのVnetを接続させることにも成功しました。イメージはこんな感じです。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="861" height="295" src="https://origin.mirai006.com/wp-content/uploads/2020/10/image-20.png" alt="" class="wp-image-1107" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-20.png 861w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-20-300x103.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-20-768x263.png 768w" sizes="(max-width: 861px) 100vw, 861px" /></figure>



<p>うぅ、インフラって楽しい。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>サイトの暗号化</title>
		<link>https://origin.mirai006.com/2020/10/04/1101</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 04 Oct 2020 08:17:48 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">https://origin.mirai006.com/?p=1101</guid>

					<description><![CDATA[このWordPressは静的ファイルを作成し、S3で運営しているのですが、大元のWordPressサイトは今まで、暗号化していませんでした。その代わり、EC2のSecurity Groupで特定のIPアドレスしか接続しな [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>このWordPressは静的ファイルを作成し、S3で運営しているのですが、大元のWordPressサイトは今まで、暗号化していませんでした。その代わり、EC2のSecurity Groupで特定のIPアドレスしか接続しないことにして、安全性を担保していました。</p>



<p>かねてよりやりたかったのですが、今までのサイトはt2インスタンスのまま使っていて、暗号化に耐えれるのかというところがあって先延ばしにしていました。この度、t4g.microにしたので、パフォーマンスもついてくるだろうと思って暗号化しました(S3に逃がしているのでメンテナンスだけなので、あまり使わないだろうという考えもあります)。</p>



<p>Let’s Encryptを使ったのですが、全然使い方が見えず、また、Amazon Linux2ではすんなり、プログラムが動かないという事もあって結構苦労しました。ちょっと落ち着いたら、再度作って見ながら、手順にまとめたいと思います。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>API Gateway → Lambda(EC2起動)</title>
		<link>https://origin.mirai006.com/2020/10/04/1077</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 04 Oct 2020 04:39:56 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://origin.mirai006.com/?p=1077</guid>

					<description><![CDATA[API GatewayからLambdaを起動し、Lambdaの中で、EC2を起動する環境を構築しました。 この環境はAuthrizationはPassphreseをLambdaの中で実施しているので、近いうちにCogni [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>API GatewayからLambdaを起動し、Lambdaの中で、EC2を起動する環境を構築しました。</p>



<p>この環境はAuthrizationはPassphreseをLambdaの中で実施しているので、近いうちにCogniteに変更する予定ですが、作るのに結構苦労したので、記載します。</p>



<p class="has-large-font-size">Lambda関数の作成</p>



<p>Lambda用のIAM Roleを作成します。内容は下記のとおりで、最小権限の考えに乗って設定します。Logを書き出すための情報と、EC2を起動できるアクションをつけ、Resource でインスタンスIDを指定します。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-">{
    &quot;Version&quot;: &quot;2012-10-17&quot;,
    &quot;Statement&quot;: [
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Action&quot;: [
                &quot;logs:CreateLogGroup&quot;,
                &quot;logs:CreateLogStream&quot;,
                &quot;logs:PutLogEvents&quot;,
                &quot;ec2:StartInstances&quot;
            ],
            &quot;Resource&quot;: [
                &quot;arn:aws:logs:*:*:*&quot;,
                &quot;arn:aws:ec2:*:*:instance/i-XXXXXXXXXXXXXXXXXXXX&quot;
            ]
        }
    ]
}</code></pre>



<p>Lambda作成の画面で、下記のように登録します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="749" height="1024" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-749x1024.png" alt="" class="wp-image-1078" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-749x1024.png 749w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-219x300.png 219w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-768x1050.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image.png 1024w" sizes="(max-width: 749px) 100vw, 749px" /></figure>



<p>Lambda関数にAPI名をしられてもパスフレーズがわからないと実行できないように、パスフレーズの確認をするようにし、ターゲットのインスタンスのインスタンスIDを設定し、デプロイします。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-">import boto3

def lambda_handler(event, context):
    if event[&#039;passphrase&#039;] == &quot;passphraseDayo&quot;:
        client = boto3.client(&#039;ec2&#039;)
        response = client.start_instances(
            InstanceIds=[
                &#039;i-XXXXXXXXXXXXXXXXXXXX&#039;,
            ]
        )
    else:
        response = &#039;bad request&#039;
    
    return response</code></pre>



<p>Lambda単体動作するかテストします。テストをクリックして、書きを登録します。</p>



<p>{<br>&#8220;passphrase&#8221;: &#8220;passphraseDayo&#8221;<br>}</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="1000" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-1.png" alt="" class="wp-image-1079" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-1.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-1-300x293.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-1-768x750.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>テストを実施すると下記のようにJsonファイルが返ってきます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="1000" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-3.png" alt="" class="wp-image-1081" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-3.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-3-300x293.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-3-768x750.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>ちなみに、パスフレーズが正しくないと下記のようになります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="1000" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-5.png" alt="" class="wp-image-1083" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-5.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-5-300x293.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-5-768x750.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="has-large-font-size">API Gatewayの作成</p>



<p>APIの作成では、REST APIで作成します。下記のように設定します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="700" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-7.png" alt="" class="wp-image-1085" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-7.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-7-300x205.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-7-768x525.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-7-250x170.png 250w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>ActionsからCreate Methodを選択し、現れたチェックボックスにGETを選択肢、<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" />をクリックします。その後、新しく右側にできたところのLambda Functionに先程作ったtestをいれ、作成します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="717" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-8-1024x717.png" alt="" class="wp-image-1086" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-8-1024x717.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-8-300x210.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-8-768x538.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-8.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>パーミッションの設定はOKをクリックし、詳細設定をしていきます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="717" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-9-1024x717.png" alt="" class="wp-image-1087" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-9-1024x717.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-9-300x210.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-9-768x538.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-9.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>まずは、GETのクエリストリングを受け付けるようにするため、Method Requestにクエリストリングの設定をします。param1という名前で受けれるようにします。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="853" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-10-1024x853.png" alt="" class="wp-image-1089" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-10-1024x853.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-10-300x250.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-10-768x640.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-10.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>←Method Executionをクリックし、元に戻り、Integration Requestをクリックし、Mapping TEmplateに下記の設定をします。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="723" height="1024" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-11-723x1024.png" alt="" class="wp-image-1090" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-11-723x1024.png 723w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-11-212x300.png 212w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-11-768x1088.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-11-1084x1536.png 1084w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-11.png 1200w" sizes="(max-width: 723px) 100vw, 723px" /></figure>



<p>←Method Executionをクリックし、元に戻り、testをリックします。Query Settingsにparam1=passphraseDayoを入れ、Testを実行します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="509" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-13-1024x509.png" alt="" class="wp-image-1093" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-13-1024x509.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-13-300x149.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-13-768x382.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-13.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>レスポンスにLambdaと同じようなJson形式の文字列が現れます。</p>



<p>実際にAPI Gatewayを利用するために、APIをデプロイします。「Actions」を選択し、Deploy APIをクリックします。デプロイでは、Deployment StageにNew Stageを選択し、Stage Name はメソッド名になるので、下記のように登録し、Deployします。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="717" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-16-1024x717.png" alt="" class="wp-image-1096" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-16-1024x717.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-16-300x210.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-16-768x538.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-16.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>APIゲートウェイが作成されます。ここに現れるInvoke URLに対して、クエリストリングをつけて実行します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="847" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-17-1024x847.png" alt="" class="wp-image-1097" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-17-1024x847.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-17-300x248.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-17-768x635.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-17.png 1263w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>今回の例では下記のようなURLになります。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-">https://82smxmuxte.execute-api.ap-northeast-1.amazonaws.com/launch-ec2?param1=passphraseDayo 
</code></pre>



<p>実行結果は下記のように、Lambdaの実行結果が返ってきます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="384" src="http://origin.mirai006.com/wp-content/uploads/2020/10/image-18-1024x384.png" alt="" class="wp-image-1098" srcset="https://origin.mirai006.com/wp-content/uploads/2020/10/image-18-1024x384.png 1024w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-18-300x113.png 300w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-18-768x288.png 768w, https://origin.mirai006.com/wp-content/uploads/2020/10/image-18.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>現在、API GatewayでPassphraseを設定し、Lambdaで確認しているのですが、この部分をCognitoに変更して実装してみたいと思います。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPressの更新自動化成功</title>
		<link>https://origin.mirai006.com/2020/10/04/1075</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sat, 03 Oct 2020 15:24:25 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://origin.mirai006.com/?p=1075</guid>

					<description><![CDATA[WordPressのEC2のS3のアップデートと、CloudFrontの最新化をInvalidationを行う処理を組み込みました。 と、この投稿がmirai006.comに現れることでチェックします。 EC2のサイトを [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>WordPressのEC2のS3のアップデートと、CloudFrontの最新化をInvalidationを行う処理を組み込みました。</p>



<p>と、この投稿がmirai006.comに現れることでチェックします。</p>



<p>EC2のサイトを東京リージョンに持ってきたので、WordPressの動きが良くなってGood!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPressサイトの更新</title>
		<link>https://origin.mirai006.com/2020/10/03/1072</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sat, 03 Oct 2020 12:50:44 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://origin.mirai006.com/?p=1072</guid>

					<description><![CDATA[WordPressのサイトはAWSで実施しています。節約のため、オハイオの環境で環境を構築していたのですが、WordPressのサイト自体は変更時にしか立ち上げないので、EC2の費用はそれほど高くないので、東京リージョン [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>WordPressのサイトはAWSで実施しています。節約のため、オハイオの環境で環境を構築していたのですが、WordPressのサイト自体は変更時にしか立ち上げないので、EC2の費用はそれほど高くないので、東京リージョンに移動をしています。</p>



<p>それに合わせてEC2のインスタンスをt4gに変更しています。WordPressで利用する、PHP、MariaDBともにARMのバージョンがあり、順調にサイトを持ってこれました。</p>



<p>これから、EC2からS3、S3からCloudFrontの設定をしていきます。</p>



<p>合わせてEC2をAPI　Gateway を通じて、起動できるようにLambdaを変更したいと思っています。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>起動時にコマンドを実行させたい</title>
		<link>https://origin.mirai006.com/2020/05/10/1005</link>
		
		<dc:creator><![CDATA[mirai]]></dc:creator>
		<pubDate>Sun, 10 May 2020 07:33:08 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://origin.mirai006.com/?p=1005</guid>

					<description><![CDATA[起動時にコマンドを実行させるために、Cronを使いました。 https://qiita.com/aki3061/items/3a3c5fca3c185173eda1 Cronには起動時に1度実行する@rebootという記 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>起動時にコマンドを実行させるために、Cronを使いました。</p>



<p><a href="https://qiita.com/aki3061/items/3a3c5fca3c185173eda1">https://qiita.com/aki3061/items/3a3c5fca3c185173eda1</a></p>



<p>Cronには起動時に1度実行する@rebootという記述ができます。これで実行させます。今回は、ec2-userでCronを実行させるようにしました。</p>



<p>対象のLinuxサーバに接続し、Bashで以下のコマンドを実施します。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-">crontab -e</code></pre>



<p>開いたテキストエディタで下記を追加します。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-">SHELL=/bin/bash

@reboot /home/ec2-user/manage/reboot.sh</code></pre>



<p>このreboot.shに下記の一文を追加しています。</p>



<pre class="wp-block-code"><code>sudo yum update -y</code></pre>



<p>また、以前に紹介した、コマンドをreboot.shに登録しています。</p>



<figure class="wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-mirai"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="Ji8guJJq6w"><a href="http://origin.mirai006.com/2020/05/09/996">EC2のIPアドレスの変更をRoute53に登録する</a></blockquote><iframe title="&#8220;EC2のIPアドレスの変更をRoute53に登録する&#8221; &#8212; mirai" class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" src="http://origin.mirai006.com/2020/05/09/996/embed#?secret=Ji8guJJq6w" data-secret="Ji8guJJq6w" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<figure class="wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-mirai"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="wLrekyA2pl"><a href="http://origin.mirai006.com/2020/05/10/1003">止め忘れを防止したい</a></blockquote><iframe title="&#8220;止め忘れを防止したい&#8221; &#8212; mirai" class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" src="http://origin.mirai006.com/2020/05/10/1003/embed#?secret=wLrekyA2pl" data-secret="wLrekyA2pl" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<p>今回、Cronの実行をec2-userにしたかですが、作業によっては6時間で済まない更新があるかもしれません。そのとき、AtコマンドのatqでAtの状況を確認し、atrmでスケジュールを削除できるのですが、Rootで動かしているのと、ログインユーザであるec2-userから確認するとき、sudo atqなど確認する必要があり、わすれそうなので、ログインユーザで設定しました。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
