<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ChungWei Wei</title>
    <description>The latest articles on DEV Community by ChungWei Wei (@gordonwei).</description>
    <link>https://dev.to/gordonwei</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1198722%2Fd47a1095-72e1-4751-a0b7-342b4cf40045.jpg</url>
      <title>DEV Community: ChungWei Wei</title>
      <link>https://dev.to/gordonwei</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gordonwei"/>
    <language>en</language>
    <item>
      <title>[Public Speech] 2024 Community Days Public Speech</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Sun, 03 Nov 2024 09:27:51 +0000</pubDate>
      <link>https://dev.to/gordonwei/public-speech-2024-community-days-public-speech-4dcd</link>
      <guid>https://dev.to/gordonwei/public-speech-2024-community-days-public-speech-4dcd</guid>
      <description>&lt;h1&gt;
  
  
  Record For My Public Speech Everytimes
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://awscmd.tw/" rel="noopener noreferrer"&gt;Website&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://share.kmp.tw/20240928_aws_cmd_GordonWei.pdf" rel="noopener noreferrer"&gt;Deck&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/lSUfwLZTAio"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>awscommunityday</category>
      <category>awstaiwan</category>
    </item>
    <item>
      <title>[AWS] How To Transfer S3 To Another Account S3 Bucket</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Sun, 08 Sep 2024 15:10:17 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-transfer-s3-to-another-account-s3-bucket-1cmi</link>
      <guid>https://dev.to/gordonwei/aws-how-to-transfer-s3-to-another-account-s3-bucket-1cmi</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Need Transfer S3 Object To Another Account's S3 Bucket
&lt;/h3&gt;

&lt;h1&gt;
  
  
  How To
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Part Account A (Source Account) Step 1
&lt;/h2&gt;

&lt;h3&gt;
  
  
  In IAM Service Create New Role For DataSync
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xfl7hu4pav1n650qh6d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xfl7hu4pav1n650qh6d.png" width="800" height="545"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyrmsfkbjr6xch8vd890c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyrmsfkbjr6xch8vd890c.png" width="800" height="443"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx7cjq3ot04ziyqbxlku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx7cjq3ot04ziyqbxlku.png" width="800" height="429"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hyqhdo42fdsdpnygqp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hyqhdo42fdsdpnygqp8.png" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  After Created Role, Add Custom Policy, Change &lt;code&gt;"arn:aws:s3:::&amp;lt;destination-bucket-name&amp;gt;&lt;/code&gt; &amp;amp; &lt;code&gt;"arn:aws:s3:::&amp;lt;destination-bucket-name&amp;gt;/*"&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:GetBucketLocation",
        "s3:ListBucket",
        "s3:ListBucketMultipartUploads"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::&amp;lt;destination-bucket-name&amp;gt;"
    },
    {
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:DeleteObject",
        "s3:GetObject",
        "s3:ListMultipartUploadParts",
        "s3:PutObject",
        "s3:GetObjectTagging",
        "s3:PutObjectTagging"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::&amp;lt;destination-bucket-name&amp;gt;/*"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Part Of Account B (Destination Account) Step 2
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create S3 Bucket For Destination, And Add Bucket Policy Source Account Role Name
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5i8wet1dazidacb82s0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5i8wet1dazidacb82s0.png" width="800" height="705"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bucket Policy
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "DataSyncCreateS3LocationAndTaskAccess",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::120340392319:role/gw-demo-datasync"
            },
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket",
                "s3:ListBucketMultipartUploads",
                "s3:AbortMultipartUpload",
                "s3:DeleteObject",
                "s3:GetObject",
                "s3:ListMultipartUploadParts",
                "s3:PutObject",
                "s3:GetObjectTagging",
                "s3:PutObjectTagging"
            ],
            "Resource": [
                "arn:aws:s3:::gw-demo-des-bucket",
                "arn:aws:s3:::gw-demo-des-bucket/*"
            ]
        },
        {
            "Sid": "DataSyncCreateS3Location",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::&amp;lt;account_id&amp;gt;:role/role-name"
            },
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::gw-demo-des-bucket"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Part Account A (Source Account) Step 3
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Change Custom Policy And Create DataSync Location
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Source Account Location
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq51h5udhgktx82tb5ciw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq51h5udhgktx82tb5ciw.png" width="612" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Destination Location
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws datasync create-location-s3 \
  --s3-bucket-arn arn:aws:s3:::&amp;lt;destination-bucket&amp;gt; \
  --region &amp;lt;destination-bucket-region&amp;gt; \
  --s3-config '{
    "BucketAccessRoleArn":"arn:aws:iam::&amp;lt;source-account-id&amp;gt;:role/&amp;lt;source-datasync-role&amp;gt;"
  }'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  After Create, You Can See Location Have Two Hosts
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjpfwk06teiv5tpcws2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjpfwk06teiv5tpcws2d.png" width="610" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part Account A (Source Account) Step 4
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Then Create Tasks, Run That
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F905bsi12g74a4u4yjnr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F905bsi12g74a4u4yjnr0.png" width="800" height="511"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8sosqs5zzojweypugfg8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8sosqs5zzojweypugfg8.png" width="800" height="526"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgouh2x3mqbmbqm9iatg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgouh2x3mqbmbqm9iatg.png" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnys9n4bnbxx40ievdbpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnys9n4bnbxx40ievdbpk.png" width="800" height="285"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzwkyq52yw0sfbd8y3g6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzwkyq52yw0sfbd8y3g6.png" width="800" height="161"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyfmsxbottqz4ec5d03f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyfmsxbottqz4ec5d03f.png" width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part Of Account B (Destination Account) Step 5
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Verify Sync After Finished
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbg3jft4l3jreqhub4u20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbg3jft4l3jreqhub4u20.png" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://docs.aws.amazon.com/datasync/latest/userguide/tutorial_s3-s3-cross-account-transfer.html" rel="noopener noreferrer"&gt;Ref Doc URL&lt;/a&gt;
&lt;/h3&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>transfer</category>
      <category>datasync</category>
    </item>
    <item>
      <title>[Git] Git Push Get Hung Up Error</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Thu, 08 Aug 2024 16:44:11 +0000</pubDate>
      <link>https://dev.to/gordonwei/git-git-push-get-hung-up-error-1cl2</link>
      <guid>https://dev.to/gordonwei/git-git-push-get-hung-up-error-1cl2</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h2&gt;
  
  
  When Run &lt;code&gt;git push&lt;/code&gt; , The Log Show &lt;code&gt;fatal: the remote end hung up unexpectedly&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (3/3), 9.94 MiB | 8.26 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How To
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Add Git Config And Re-Push Again
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;git config --local http.postBuffer 524288000&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 9.94 MiB | 14.31 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Validating objects: 100%
To https://git-codecommit.us-east-1.amazonaws.com/v1/repos/&amp;lt;your-repo&amp;gt;
   9115319..94a8c94  main -&amp;gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Root Cause
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Git &lt;code&gt;http.postBuffer&lt;/code&gt; &lt;a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-httppostBuffer" rel="noopener noreferrer"&gt;Default Is 1 MiB&lt;/a&gt;, So Need Change Config
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http.postBuffer
Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.

Note that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard. Raising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>aws</category>
      <category>git</category>
      <category>codecommit</category>
      <category>giterror</category>
    </item>
    <item>
      <title>[AWS] How To Get Parameter Store From EC2 UserData</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Tue, 02 Apr 2024 06:01:27 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-get-parameter-store-from-ec2-userdata-2pkf</link>
      <guid>https://dev.to/gordonwei/aws-how-to-get-parameter-store-from-ec2-userdata-2pkf</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Get Parameter Store When EC2 Launch New Instance
&lt;/h2&gt;

&lt;h1&gt;
  
  
  How To
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Add Parameter Store
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8G00oBY5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8G00oBY5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore1.png" alt="" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Role Policy Into &lt;code&gt;IAM Instance Profile&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  create new policy &lt;code&gt;get-demo-parameter&lt;/code&gt; and attach to &lt;code&gt;iam instance profile&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ssm:GetParameter",
            "Resource": "arn:aws:ssm:ap-northeast-1:&amp;lt;your-account-id&amp;gt;:parameter/&amp;lt;parameter-store-name&amp;gt;
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i2tZ1mZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i2tZ1mZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore2.png" alt="" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Launch New VM Instance And Add UserData
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--krQdXYz4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--krQdXYz4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore3.png" alt="" width="800" height="868"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oIdRBH1i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oIdRBH1i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore4.png" alt="" width="800" height="470"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AWw-UW5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AWw-UW5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore5.png" alt="" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  User Data Script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

export AWS_DEFAULT_REGION=ap-northeast-1

get_para=$(aws ssm get-parameter --name &amp;lt;parameter-name&amp;gt; --query Parameter.Value --output text)
echo $get_para &amp;gt; /tmp/para.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  After Boot Finished
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nUNa4q68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nUNa4q68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ec2UserDataGetParameterStore6.png" alt="" width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Debug From Cloud-Init Log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

cat /var/log/cloud-init.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ec2</category>
      <category>userdata</category>
      <category>parameterstore</category>
    </item>
    <item>
      <title>[AWS] How To Connect Site To Site VPN With EdgeRouter X</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Mon, 22 Jan 2024 15:39:57 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-connect-site-to-site-vpn-with-edgerouter-x-4k0c</link>
      <guid>https://dev.to/gordonwei/aws-how-to-connect-site-to-site-vpn-with-edgerouter-x-4k0c</guid>
      <description>&lt;h1&gt;
  
  
  Environment
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Cloud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CIDR : 172.31.0.0/16&lt;/li&gt;
&lt;li&gt;Public :  X.X.X.X&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  On-Premise
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CIDR : 172.16.0.0/16&lt;/li&gt;
&lt;li&gt;Public : Y.Y.Y.Y
# How To
## Part of AWS&lt;/li&gt;
&lt;li&gt;Create Customer Gateway (CGW)
#### Create CGW
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fxw38xgu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN01.png" alt="" width="800" height="221"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter Name tag, GP ASN, Certificate ARN
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YQyVmVG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YQyVmVG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN02.png" alt="" width="800" height="748"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create Virtual Private Gateway (VGW)
#### Create VGW
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jglHfS9h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN03.png" alt="" width="800" height="41"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter The Name, And Choice ASN
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IrFHj1Ft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IrFHj1Ft--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN04.png" alt="" width="800" height="592"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R5P8wUCw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R5P8wUCw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN05.png" alt="" width="800" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Attach VPC
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ICH9PCWS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ICH9PCWS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN13.png" alt="" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Setting Route Table&lt;/p&gt;
&lt;h4&gt;
  
  
  Create Static Route Table
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mTS1ylYa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mTS1ylYa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN06.png" alt="" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create Site to Site VPN Connect&lt;/p&gt;
&lt;h4&gt;
  
  
  Create VPN Connect
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IDdoRzlE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IDdoRzlE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN07.png" alt="" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter, Choice VPN Tunnel Information
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yO0CT2fp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yO0CT2fp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN08.png" alt="" width="800" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Enter Tunnel Options
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zr0QdJ3F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zr0QdJ3F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN09.png" alt="" width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  After Create Then Wait
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uL-8TBxL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uL-8TBxL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN10.png" alt="" width="800" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Download Conf If Needed
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yv3h3opx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yv3h3opx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN12.png" alt="" width="612" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part of Edge Router X
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh adm@fw

# Conf mode
configure

# Enable the auto-firewall-nat-exclude feature which automatically creates the IPsec firewall/NAT policies in the firewall.iptables
set vpn ipsec auto-firewall-nat-exclude enable

# Create the IKE / Phase 1 (P1) Security Associations (SAs) and enable Dead Peer Detection (DPD).
set vpn ipsec ike-group FOO0 key-exchange ikev1
set vpn ipsec ike-group FOO0 lifetime 28800
set vpn ipsec ike-group FOO0 proposal 1 dh-group 2
set vpn ipsec ike-group FOO0 proposal 1 encryption aes128
set vpn ipsec ike-group FOO0 proposal 1 hash sha1
set vpn ipsec ike-group FOO0 dead-peer-detection action restart
set vpn ipsec ike-group FOO0 dead-peer-detection interval 15
set vpn ipsec ike-group FOO0 dead-peer-detection timeout 30


# Create the ESP / Phase 2 (P2) SAs and enable Perfect Forward Secrecy (PFS)
set vpn ipsec esp-group FOO0 lifetime 3600
set vpn ipsec esp-group FOO0 pfs enable
set vpn ipsec esp-group FOO0 proposal 1 encryption aes128
set vpn ipsec esp-group FOO0 proposal 1 hash sha1

# Define the first AWS peer address
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; authentication mode pre-shared-secret
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; authentication pre-shared-secret &amp;lt;Secret_From_Download_File&amp;gt;
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; connection-type initiate
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; description ipsec-aws
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; local-address &amp;lt;Your_Pub_IP&amp;gt;

# Link the SAs created above to the first AWS peer and bind the VPN to a virtual tunnel interface (vti0).
set vpn ipsec site-to-site peer 192.0.2.1 ike-group FOO0
set vpn ipsec site-to-site peer 192.0.2.1 vti bind vti0
set vpn ipsec site-to-site peer 192.0.2.1 vti esp-group FOO0

# Configure the RFC 3927 IP addresses on the virtual tunnel interfaces
set interfaces vti vti0 address 169.254.x.x/30

# Lower the TCP Maximum Segment Size (MSS) on the vti interfaces to 1379.
set firewall options mss-clamp interface-type vti
set firewall options mss-clamp mss 1379

# Set route table
set protocols static interface-route 172.31.0.0/16 next-hop-interface vti0

# Apply conf &amp;amp; save conf
commit ; save

# Verify ike
show vpn ipsec ike-group FOO0
 dead-peer-detection {
     action restart
     interval 15
     timeout 30
 }
 ikev2-reauth no
 key-exchange ikev1
 lifetime 28800
 proposal 1 {
     dh-group 2
     encryption aes128
     hash sha1

# Verify esp
show vpn ipsec esp-group FOO0
 compression disable
 lifetime 3600
 mode tunnel
 pfs enable
 proposal 1 {
     encryption aes128
     hash sha1
    }
# Verify ipsec
show vpn ipsec site-to-site peer

peer &amp;lt;AWS_VGW_IP&amp;gt; {
     authentication {
         mode pre-shared-secret
         pre-shared-secret &amp;lt;AWS_Secret&amp;gt;
     }
     connection-type initiate
     description ipsec-AWS
     ike-group FOO0
     local-address &amp;lt;Local_Pub_IP&amp;gt;
     vti {
         bind vti0
         esp-group FOO0
     }
 }




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Wait To Tunnel Up
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fl-CzYNN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fl-CzYNN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN11.png" alt="" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Verify
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ne0ky3kA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ne0ky3kA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/s2sVPN14.png" alt="" width="800" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sitetositevpn</category>
      <category>networking</category>
      <category>edgerouterx</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>[AWS] How To Create Site To Site From EdgeRouter X With AWS</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Mon, 22 Jan 2024 15:10:11 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-create-site-to-site-from-edgerouter-x-with-aws-2hi5</link>
      <guid>https://dev.to/gordonwei/aws-how-to-create-site-to-site-from-edgerouter-x-with-aws-2hi5</guid>
      <description>&lt;h1&gt;
  
  
  Environment
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Cloud
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;### CIDR : 172.31.0.0/16&lt;/li&gt;
&lt;li&gt;### Public :  X.X.X.X&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  On-Premise
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;### CIDR : 172.16.0.0/16&lt;/li&gt;
&lt;li&gt;### Public : Y.Y.Y.Y
# How To
## Part of AWS&lt;/li&gt;
&lt;li&gt;### Create Customer Gateway (CGW)
#### Create CGW
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4bymtnfljvvguu72e3e.png" width="800" height="221"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter Name tag, GP ASN, Certificate ARN
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq7szoj5n2phwedzo9e9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq7szoj5n2phwedzo9e9.png" width="800" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;### Create Virtual Private Gateway (VGW)
#### Create VGW
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00fasdoaompr1t6r1anf.png" width="800" height="40"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter The Name, And Choice ASN
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmrjtgkkbvcgks6z0hh5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmrjtgkkbvcgks6z0hh5w.png" width="800" height="592"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb0t61hli00fd5afdwie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb0t61hli00fd5afdwie.png" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Attach VPC
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdity42ygs0sqaue74yh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdity42ygs0sqaue74yh.png" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Setting Route Table
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Create Static Route Table
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f0rsyi7kd1s27exhcrw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f0rsyi7kd1s27exhcrw.png" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Create Site to Site VPN Connect
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Create VPN Connect
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3jaknb0f5bxf1bgxnji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3jaknb0f5bxf1bgxnji.png" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Enter, Choice VPN Tunnel Information
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgs3v6mt5unh9iyzt3wh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgs3v6mt5unh9iyzt3wh.png" width="800" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Enter Tunnel Options
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx75k4b1y4dcw9plaewd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx75k4b1y4dcw9plaewd.png" width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  After Create Then Wait
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmtbfoba1ud2vsbkmrf4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmtbfoba1ud2vsbkmrf4.png" width="800" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Download Conf If Needed
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwmkcvnscpab5svi3o7j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwmkcvnscpab5svi3o7j.png" width="612" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part of Edge Router X
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh adm@fw

# Conf mode
configure

# Enable the auto-firewall-nat-exclude feature which automatically creates the IPsec firewall/NAT policies in the firewall.iptables
set vpn ipsec auto-firewall-nat-exclude enable

# Create the IKE / Phase 1 (P1) Security Associations (SAs) and enable Dead Peer Detection (DPD).
set vpn ipsec ike-group FOO0 key-exchange ikev1
set vpn ipsec ike-group FOO0 lifetime 28800
set vpn ipsec ike-group FOO0 proposal 1 dh-group 2
set vpn ipsec ike-group FOO0 proposal 1 encryption aes128
set vpn ipsec ike-group FOO0 proposal 1 hash sha1
set vpn ipsec ike-group FOO0 dead-peer-detection action restart
set vpn ipsec ike-group FOO0 dead-peer-detection interval 15
set vpn ipsec ike-group FOO0 dead-peer-detection timeout 30


# Create the ESP / Phase 2 (P2) SAs and enable Perfect Forward Secrecy (PFS)
set vpn ipsec esp-group FOO0 lifetime 3600
set vpn ipsec esp-group FOO0 pfs enable
set vpn ipsec esp-group FOO0 proposal 1 encryption aes128
set vpn ipsec esp-group FOO0 proposal 1 hash sha1

# Define the first AWS peer address
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; authentication mode pre-shared-secret
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; authentication pre-shared-secret &amp;lt;Secret_From_Download_File&amp;gt;
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; connection-type initiate
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; description ipsec-aws
set vpn ipsec site-to-site peer &amp;lt;VGW_IP&amp;gt; local-address &amp;lt;Your_Pub_IP&amp;gt;

# Link the SAs created above to the first AWS peer and bind the VPN to a virtual tunnel interface (vti0).
set vpn ipsec site-to-site peer 192.0.2.1 ike-group FOO0
set vpn ipsec site-to-site peer 192.0.2.1 vti bind vti0
set vpn ipsec site-to-site peer 192.0.2.1 vti esp-group FOO0

# Configure the RFC 3927 IP addresses on the virtual tunnel interfaces
set interfaces vti vti0 address 169.254.x.x/30

# Lower the TCP Maximum Segment Size (MSS) on the vti interfaces to 1379.
set firewall options mss-clamp interface-type vti
set firewall options mss-clamp mss 1379

# Set route table
set protocols static interface-route 172.31.0.0/16 next-hop-interface vti0

# Apply conf &amp;amp; save conf
commit ; save

# Verify ike
show vpn ipsec ike-group FOO0
 dead-peer-detection {
     action restart
     interval 15
     timeout 30
 }
 ikev2-reauth no
 key-exchange ikev1
 lifetime 28800
 proposal 1 {
     dh-group 2
     encryption aes128
     hash sha1


# Verify esp
show vpn ipsec esp-group FOO0
 compression disable
 lifetime 3600
 mode tunnel
 pfs enable
 proposal 1 {
     encryption aes128
     hash sha1
    }
# Verify ipsec
show vpn ipsec site-to-site peer

peer &amp;lt;AWS_VGW_IP&amp;gt; {
     authentication {
         mode pre-shared-secret
         pre-shared-secret &amp;lt;AWS_Secret&amp;gt;
     }
     connection-type initiate
     description ipsec-AWS
     ike-group FOO0
     local-address &amp;lt;Local_Pub_IP&amp;gt;
     vti {
         bind vti0
         esp-group FOO0
     }
 }




&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Wait To Tunnel Up
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3og6yuazvtf4r0vn4wd6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3og6yuazvtf4r0vn4wd6.png" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Verify
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs0cdgpyvwg57qvjh7fc4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs0cdgpyvwg57qvjh7fc4.png" width="800" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>site2sitevpn</category>
      <category>onpremise</category>
      <category>aws</category>
    </item>
    <item>
      <title>[AWS] How To Add Basic Auth With Amazon CloudFront</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Thu, 28 Dec 2023 02:55:26 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-add-basic-auth-with-amazon-cloudfront-2adj</link>
      <guid>https://dev.to/gordonwei/aws-how-to-add-basic-auth-with-amazon-cloudfront-2adj</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Want Set Basic Auth With AWS CloudFront
&lt;/h3&gt;

&lt;h1&gt;
  
  
  How To
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XdGnVtDH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igj7ratt7e3qapc66ixz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XdGnVtDH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igj7ratt7e3qapc66ixz.png" alt="Image 000" width="449" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conponent
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3&lt;/li&gt;
&lt;li&gt;AWS CloudFront&lt;/li&gt;
&lt;li&gt;AWS CloudFront Function&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Part Of CloudFront Function
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create New CloudFront Function
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w3WsG-Vv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlr2gywpg654g6pwwq5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w3WsG-Vv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlr2gywpg654g6pwwq5w.png" alt="Image 001" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter Function Name , And Choice js-1.0 Runtime
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aQTYdZ_O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2n7btqwa9qs55krpfkp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aQTYdZ_O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2n7btqwa9qs55krpfkp.png" alt="Image 002" width="800" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter The Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P4neT-PA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4h0vk7nj5wndjx01aim.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4neT-PA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4h0vk7nj5wndjx01aim.png" alt="Image 003" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part Of CloudFront
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create New Behavior
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AKJJbpQn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4er59rzikchtschhnil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AKJJbpQn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4er59rzikchtschhnil.png" alt="Image 004" width="800" height="737"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  On Function Associations, Choice Viewer request Setting &lt;code&gt;CloudFront Functions&lt;/code&gt; And Select &lt;code&gt;Function Name&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5ge3yksf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyfl4e0xpvzdunbfhagn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5ge3yksf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyfl4e0xpvzdunbfhagn.png" alt="Image description" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qCGgCYtC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rxdowr5tiqgylktv33a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qCGgCYtC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rxdowr5tiqgylktv33a.png" alt="Image description" width="634" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudfront</category>
      <category>cloudfrontfunction</category>
      <category>basicauth</category>
    </item>
    <item>
      <title>[GCP] Google Cloud Certified - Professional Cloud Network Engineer</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Fri, 24 Nov 2023 19:42:44 +0000</pubDate>
      <link>https://dev.to/gordonwei/gcp-google-cloud-certified-professional-cloud-network-engineer-4aof</link>
      <guid>https://dev.to/gordonwei/gcp-google-cloud-certified-professional-cloud-network-engineer-4aof</guid>
      <description>&lt;h2&gt;
  
  
  這次準備的內容為 &lt;code&gt;GCP Certified - Professional Cloud  Network Engineer&lt;/code&gt; 的認證
&lt;/h2&gt;

&lt;h2&gt;
  
  
  學習路徑為依然為 &lt;a href="https://jayendrapatil.com/google-cloud-professional-cloud-network-engineer-certification-learning-path//"&gt;Jayendra's Blog&lt;/a&gt; 與官方文件
&lt;/h2&gt;

&lt;h2&gt;
  
  
  考試相關內容如下：
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;120 分鐘內考 50 題選擇題, 包含多選&lt;/li&gt;
&lt;li&gt;考試內容大多為網路方面的調整與選擇&lt;/li&gt;
&lt;li&gt;Interconnect, Cloud Route, Shared VPC, Loan Balancer&lt;/li&gt;
&lt;li&gt;有關於 GKE Cluster 與 Pod 的網段要稍稍計算一下&lt;/li&gt;
&lt;li&gt;依照題型給予的狀況去選擇適合的 LoadBalancer 也有出現好幾題&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  最後, 就不免俗的放上證照 :D
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KwpyljtH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/http://img.kmp.tw/gcpnetwork.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KwpyljtH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/http://img.kmp.tw/gcpnetwork.png" alt="GCP_Cert" width="600" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gcpcertificated</category>
      <category>cloud</category>
      <category>gcpnetwork</category>
      <category>gcp</category>
    </item>
    <item>
      <title>[Docker] Build Flask Service Docker Image</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Sun, 15 Oct 2023 16:31:55 +0000</pubDate>
      <link>https://dev.to/gordonwei/docker-build-flask-service-docker-image-24k2</link>
      <guid>https://dev.to/gordonwei/docker-build-flask-service-docker-image-24k2</guid>
      <description>&lt;h1&gt;
  
  
  Env
&lt;/h1&gt;

&lt;h2&gt;
  
  
  All Component
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;### Alpine Linux Image With Python 3.12 ( recommendation )&lt;/li&gt;
&lt;li&gt;### Python Package List&lt;/li&gt;
&lt;li&gt;### Source Code
&amp;lt;!--more--&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Image
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ytiMYsoC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ytiMYsoC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker01.png" alt="img01" width="800" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Folder Tree
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v1xKxZ9V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v1xKxZ9V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker02.png" alt="img02" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Build Image
&lt;/h1&gt;

&lt;h2&gt;
  
  
  File &lt;code&gt;dockerfile&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/demo/docker-img/flask (master*) » cat dockerfile

FROM python:alpine3.18
WORKDIR /api
ADD ./files/ /api
RUN pip install -r requirements.txt
CMD python main.py

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  File &lt;code&gt;requirements.txt&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/demo/docker-img/flask/files (master*) » cat requirements.txt
Click==8.1.7
Flask==3.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
Werkzeug==3.0.0
requests==2.31.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  File &lt;code&gt;main.py&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/python3
# -*- coding: utf8 -*-

'''
author         GordonWei
date           10/15/2023
comment        Test Flask Website
'''

'''
Just test
'''

from flask import Flask, request, render_template
import flask, json

app = flask.Flask(__name__)
#app.config["DEBUG"] = True

commit = []

@app.route('/', methods=['GET'])
def home():
  return "&amp;lt;h1&amp;gt;Nothing, Just A Index!&amp;lt;/h1&amp;gt;"

app.run(host='0.0.0.0', port='8008')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Build
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t &amp;lt;your-img-name:tag&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/demo/docker-img/flask (master*) » docker build -t flask-demo:0.4 .
[+] Building 8.8s (9/9) FINISHED                                                                           docker:desktop-linux
 =&amp;gt; [internal] load .dockerignore                                                                                          0.0s
 =&amp;gt; =&amp;gt; transferring context: 2B                                                                                            0.0s
 =&amp;gt; [internal] load build definition from dockerfile                                                                       0.0s
 =&amp;gt; =&amp;gt; transferring dockerfile: 148B                                                                                       0.0s
 =&amp;gt; [internal] load metadata for docker.io/library/python:alpine3.18                                                       0.0s
 =&amp;gt; [1/4] FROM docker.io/library/python:alpine3.18                                                                         0.0s
 =&amp;gt; [internal] load build context                                                                                          0.0s
 =&amp;gt; =&amp;gt; transferring context: 1.97kB                                                                                        0.0s
 =&amp;gt; [2/4] WORKDIR /api                                                                                                     0.0s
 =&amp;gt; [3/4] ADD ./files/ /api                                                                                                0.0s
 =&amp;gt; [4/4] RUN pip install -r requirements.txt                                                                              8.6s
 =&amp;gt; exporting to image                                                                                                     0.1s
 =&amp;gt; =&amp;gt; exporting layers                                                                                                    0.1s
 =&amp;gt; =&amp;gt; writing image sha256:e457f32666126e35eaca9bbe4aa55accc591a2ebfec2386203889262cbdce9cf                               0.0s
 =&amp;gt; =&amp;gt; naming to docker.io/library/flask-demo:0.4                                                                          0.0s

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verify
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/demo/docker-img/flask (master*) » docker images | grep flask-demo
flask-demo                                              0.4               e457f3266612   About a minute ago   76.6MB
flask-demo                                              0.3               50d74e0a22b0   2 days ago           76.6MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Try Run
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/demo/docker-img/flask (master*) » docker run -idt -p 80:8008 flask-demo:0.4
3d886093528c70d7aed6c037674f059d83260b60a689ba633c342a162f430380
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Screenshot
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7VYP7f11--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7VYP7f11--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/flask_docker03.png" alt="img03" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containerimage</category>
      <category>python</category>
      <category>flask</category>
    </item>
    <item>
      <title>[AWS] How To Install Cloud Watch Agent To EC2 Linux With SSM</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Fri, 06 Oct 2023 12:18:11 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-install-cloud-watch-agent-to-ec2-linux-with-ssm-1j44</link>
      <guid>https://dev.to/gordonwei/aws-how-to-install-cloud-watch-agent-to-ec2-linux-with-ssm-1j44</guid>
      <description>&lt;h1&gt;
  
  
  Before Start
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Part of AWS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create new &lt;code&gt;Role&lt;/code&gt; for EC2 or attach new policy to exist &lt;code&gt;Role&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;### The Role Must Have

&lt;ul&gt;
&lt;li&gt;###  &lt;code&gt;CloudWatchAgentServerPolicy&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;### &lt;code&gt;AmazonSSMManagedInstanceCore&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;### inline policy &lt;code&gt;ssm:putparameter&lt;/code&gt; (if you want store your conf to &lt;code&gt;Parameter Store&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t89UsEkV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa001.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t89UsEkV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa001.png" alt="001" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part of VM
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Install &lt;code&gt;Collectd&lt;/code&gt; if system don't have
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt update &amp;amp;&amp;amp; apt install collectd -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Install Cloud Watch Agent
&lt;/h1&gt;

&lt;h2&gt;
  
  
  In SSM console, choice &lt;code&gt;Run Command&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Select &lt;code&gt;AWS-ConfigureAWSPackage&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0T50ydHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa002.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0T50ydHw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa002.png" alt="002" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting like ref pic
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1ANjo0AW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa003.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1ANjo0AW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa003.png" alt="003" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Choice instance you need install's EC2
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jZzvHXHs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa004.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jZzvHXHs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa004.png" alt="004" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Then click &lt;code&gt;Run&lt;/code&gt;
&lt;/h3&gt;

&lt;h1&gt;
  
  
  Setting Cloud Watch Agent Conf
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Log into VM, run wizard command
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting screen looks like these
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;================================================================
= Welcome to the Amazon CloudWatch Agent Configuration Manager =
=                                                              =
= CloudWatch Agent allows you to collect metrics and logs from =
= your host and send them to CloudWatch. Additional CloudWatch =
= charges may apply.                                           =
================================================================
On which OS are you planning to use the agent?
1. linux
2. windows
3. darwin
default choice: [1]:

Trying to fetch the default region based on ec2 metadata...
Are you using EC2 or On-Premises hosts?
1. EC2
2. On-Premises
default choice: [1]:

Which user are you planning to run the agent?
1. root
2. cwagent
3. others
default choice: [1]:

Do you want to turn on StatsD daemon?
1. yes
2. no
default choice: [1]:

Which port do you want StatsD daemon to listen to?
default choice: [8125]

What is the collect interval for StatsD daemon?
1. 10s
2. 30s
3. 60s
default choice: [1]:

What is the aggregation interval for metrics collected by StatsD daemon?
1. Do not aggregate
2. 10s
3. 30s
4. 60s
default choice: [4]:

Do you want to monitor metrics from CollectD? WARNING: CollectD must be installed or the Agent will fail to start
1. yes
2. no
default choice: [1]:

Do you want to monitor any host metrics? e.g. CPU, memory, etc.
1. yes
2. no
default choice: [1]:

Do you want to monitor cpu metrics per core?
1. yes
2. no
default choice: [1]:

Do you want to add ec2 dimensions (ImageId, InstanceId, InstanceType, AutoScalingGroupName) into all of your metrics if the info is available?
1. yes
2. no
default choice: [1]:

Do you want to aggregate ec2 dimensions (InstanceId)?
1. yes
2. no
default choice: [1]:

Would you like to collect your metrics at high resolution (sub-minute resolution)? This enables sub-minute resolution for all metrics, but you can customize for specific metrics in the output json file.
1. 1s
2. 10s
3. 30s
4. 60s
default choice: [4]:

Which default metrics config do you want?
1. Basic
2. Standard
3. Advanced
4. None
default choice: [1]:
2
Current config as follows:
{
    "agent": {
        "metrics_collection_interval": 60,
        "run_as_user": "root"
    },
    "metrics": {
        "aggregation_dimensions": [
            [
                "InstanceId"
            ]
        ],
        "append_dimensions": {
            "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
            "ImageId": "${aws:ImageId}",
            "InstanceId": "${aws:InstanceId}",
            "InstanceType": "${aws:InstanceType}"
        },
        "metrics_collected": {
            "collectd": {
                "metrics_aggregation_interval": 60
            },
            "cpu": {
                "measurement": [
                    "cpu_usage_idle",
                    "cpu_usage_iowait",
                    "cpu_usage_user",
                    "cpu_usage_system"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ],
                "totalcpu": false
            },
            "disk": {
                "measurement": [
                    "used_percent",
                    "inodes_free"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "diskio": {
                "measurement": [
                    "io_time"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "mem": {
                "measurement": [
                    "mem_used_percent"
                ],
                "metrics_collection_interval": 60
            },
            "statsd": {
                "metrics_aggregation_interval": 60,
                "metrics_collection_interval": 10,
                "service_address": ":8125"
            },
            "swap": {
                "measurement": [
                    "swap_used_percent"
                ],
                "metrics_collection_interval": 60
            }
        }
    }
}
Are you satisfied with the above config? Note: it can be manually customized after the wizard completes to add additional items.
1. yes
2. no
default choice: [1]:

Do you have any existing CloudWatch Log Agent (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html) configuration file to import for migration?
1. yes
2. no
default choice: [2]:

Do you want to monitor any log files?
1. yes
2. no
default choice: [1]:
2
Saved config file to /opt/aws/amazon-cloudwatch-agent/bin/config.json successfully.
Current config as follows:
{
    "agent": {
        "metrics_collection_interval": 60,
        "run_as_user": "root"
    },
    "metrics": {
        "aggregation_dimensions": [
            [
                "InstanceId"
            ]
        ],
        "append_dimensions": {
            "AutoScalingGroupName": "${aws:AutoScalingGroupName}",
            "ImageId": "${aws:ImageId}",
            "InstanceId": "${aws:InstanceId}",
            "InstanceType": "${aws:InstanceType}"
        },
        "metrics_collected": {
            "collectd": {
                "metrics_aggregation_interval": 60
            },
            "cpu": {
                "measurement": [
                    "cpu_usage_idle",
                    "cpu_usage_iowait",
                    "cpu_usage_user",
                    "cpu_usage_system"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ],
                "totalcpu": false
            },
            "disk": {
                "measurement": [
                    "used_percent",
                    "inodes_free"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "diskio": {
                "measurement": [
                    "io_time"
                ],
                "metrics_collection_interval": 60,
                "resources": [
                    "*"
                ]
            },
            "mem": {
                "measurement": [
                    "mem_used_percent"
                ],
                "metrics_collection_interval": 60
            },
            "statsd": {
                "metrics_aggregation_interval": 60,
                "metrics_collection_interval": 10,
                "service_address": ":8125"
            },
            "swap": {
                "measurement": [
                    "swap_used_percent"
                ],
                "metrics_collection_interval": 60
            }
        }
    }
}
Please check the above content of the config.
The config file is also located at /opt/aws/amazon-cloudwatch-agent/bin/config.json.
Edit it manually if needed.
Do you want to store the config in the SSM parameter store?
1. yes
2. no
default choice: [1]:

What parameter store name do you want to use to store your config? (Use 'AmazonCloudWatch-' prefix if you use our managed AWS policy)
default choice: [AmazonCloudWatch-linux]

Trying to fetch the default region based on ec2 metadata...
Which region do you want to store the config in the parameter store?
default choice: [us-east-1]

Which AWS credential should be used to send json config to parameter store?
1. 12312312321312312(From SDK)
2. Other
default choice: [1]:

Successfully put config to parameter store AmazonCloudWatch-linux.
Program exits now.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Restart Cloud Watch Agent from SSM
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FwXAd_wO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa005.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FwXAd_wO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa005.png" alt="005" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AcS3ouB7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa006.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AcS3ouB7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa006.png" alt="006" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ixsvzTsi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa007.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ixsvzTsi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa007.png" alt="007" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Then click &lt;code&gt;Run&lt;/code&gt;, and wait to success
&lt;/h3&gt;

&lt;h1&gt;
  
  
  Go To Cloud Watch dashboard verify
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L97lGi5s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa008.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L97lGi5s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/ssm_ec2_cwa008.png" alt="008" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>ssm</category>
      <category>cloudwatchagent</category>
    </item>
    <item>
      <title>[Linux] How To Stop Ubuntu 22.04 Sleep With Command</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Sun, 16 Apr 2023 15:23:17 +0000</pubDate>
      <link>https://dev.to/gordonwei/linux-how-to-stop-ubuntu-2204-sleep-with-command-13bb</link>
      <guid>https://dev.to/gordonwei/linux-how-to-stop-ubuntu-2204-sleep-with-command-13bb</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Prevent Machine Sleep
&lt;/h3&gt;

&lt;h1&gt;
  
  
  How To
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Check &lt;code&gt;sleep.target&lt;/code&gt; Status
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@desktop:~# systemctl status sleep.target
○ sleep.target - Sleep
     Loaded: loaded (/lib/systemd/system/sleep.target; static)
     Active: inactive (dead) since Wed 2023-03-29 00:02:04 CST; 6min ago
       Docs: man:systemd.special(7)

Feb 03 10:00:50 desktop systemd[1]: Reached target Sleep.
Mar 29 00:02:04 desktop systemd[1]: Stopped target Sleep.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set &lt;code&gt;mask&lt;/code&gt; In &lt;code&gt;sleep.target&lt;/code&gt;,&lt;code&gt;suspend.target&lt;/code&gt;, &lt;code&gt;hibernate.target&lt;/code&gt; And &lt;code&gt;hybrid-sleep.target&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@desktop:~# systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Created symlink /etc/systemd/system/sleep.target → /dev/null.
Created symlink /etc/systemd/system/suspend.target → /dev/null.
Created symlink /etc/systemd/system/hibernate.target → /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null.
root@desktop:~# systemctl status sleep.target
○ sleep.target
     Loaded: masked (Reason: Unit sleep.target is masked.)
     Active: inactive (dead) since Wed 2023-03-29 00:02:04 CST; 8min ago

Feb 03 10:00:50 desktop systemd[1]: Reached target Sleep.
Mar 29 00:02:04 desktop systemd[1]: Stopped target Sleep.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Done
&lt;/h3&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>sleepmode</category>
      <category>hibernatemode</category>
    </item>
    <item>
      <title>[AWS] How To Query CloudWatch Logs Using Amazon Athena</title>
      <dc:creator>ChungWei Wei</dc:creator>
      <pubDate>Mon, 03 Apr 2023 19:23:14 +0000</pubDate>
      <link>https://dev.to/gordonwei/aws-how-to-query-cloudwatch-logs-using-amazon-athena-pki</link>
      <guid>https://dev.to/gordonwei/aws-how-to-query-cloudwatch-logs-using-amazon-athena-pki</guid>
      <description>&lt;h1&gt;
  
  
  Situation
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Integration Cloud Watch &amp;amp; Amazon Athena
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Step 1 : Add Athena Data Source
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SDFGLI9---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SDFGLI9---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena01.png" alt="img01" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Choice Amazon CloudWatch Logs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qggVzMK9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qggVzMK9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena02.png" alt="img02" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter Source Name And Click Create Connector Lambda Function
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N070RBiv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N070RBiv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena03.png" alt="img03" width="800" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  In Application Settings, Enter Your &lt;code&gt;Bucket Name&lt;/code&gt; To SpillBucket, Then Click Deploy
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OrYQfl9a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OrYQfl9a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena04.png" alt="img04" width="800" height="316"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QwoRBPJC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QwoRBPJC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena14.png" alt="img14" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TYhxPbBT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TYhxPbBT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena05.png" alt="img05" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Go Back To Athena Page, And Click Next
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y65rIVgy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y65rIVgy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena06.png" alt="img06" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  After Review, Click Create Data Source
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pfXJsslK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pfXJsslK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena07.png" alt="img07" width="800" height="605"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9KPqTQfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9KPqTQfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena08.png" alt="img08" width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 : Create WorkGroup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Enter WorkGroup Name, Choice Engine Type.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zmIIMFX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zmIIMFX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena09.png" alt="img09" width="800" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  In Query Edit Console, Add Query Result Bucket And Click Save.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xGGaIJ0O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xGGaIJ0O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena10.png" alt="img10" width="800" height="534"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ijYn7CZF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ijYn7CZF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena11.png" alt="img11" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 : Go To Athena Edit Page, Enter Query &amp;amp; Run That.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v3zTfHi2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v3zTfHi2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena12.png" alt="img12" width="800" height="259"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZYz4FnCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZYz4FnCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.kmp.tw/HowToQueryCloudWatchLogsUsingAmazonAthena13.png" alt="img13" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloudwatchandathena</category>
      <category>cloudwatch</category>
      <category>athena</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
