<?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: Lam Wing Chun</title>
    <description>The latest articles on DEV Community by Lam Wing Chun (@oscaroscarlam).</description>
    <link>https://dev.to/oscaroscarlam</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%2F885592%2F5eb8130a-f93a-44de-9b8d-004dbef97141.png</url>
      <title>DEV Community: Lam Wing Chun</title>
      <link>https://dev.to/oscaroscarlam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oscaroscarlam"/>
    <language>en</language>
    <item>
      <title>AWS Relational Database Service (RDS) Overview</title>
      <dc:creator>Lam Wing Chun</dc:creator>
      <pubDate>Sun, 09 Jul 2023 12:01:49 +0000</pubDate>
      <link>https://dev.to/oscaroscarlam/aws-relational-database-service-rds-overview-3el2</link>
      <guid>https://dev.to/oscaroscarlam/aws-relational-database-service-rds-overview-3el2</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3xkIwVIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kttmkl7crp4w5mnfb6lg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3xkIwVIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kttmkl7crp4w5mnfb6lg.jpg" alt="Image description" width="800" height="755"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Outline
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Introduction &amp;amp; Deployment&lt;/li&gt;
&lt;li&gt;RDS Connection and SQL Query&lt;/li&gt;
&lt;li&gt;Backup and Restore&lt;/li&gt;
&lt;li&gt;High Availablity &amp;amp; Disaster Recovery&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Introduction &amp;amp; Deployment
&lt;/h2&gt;

&lt;p&gt;Amazon Relational Database Service (Amazon RDS) is a managed database service While RDS can be deployed on &lt;strong&gt;EC2&lt;/strong&gt; or &lt;strong&gt;Outposts&lt;/strong&gt; (the service that allow you to run AWS services on Premises Private Cloud).&lt;/p&gt;

&lt;p&gt;When deploying RDS, we need to specify the EC2 instance specification such as vCPUs and RAM.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NuzglRVy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zd1lxem6s9bbkw80pvf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NuzglRVy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zd1lxem6s9bbkw80pvf3.png" alt="Image description" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, RDS supports different &lt;strong&gt;database engine types&lt;/strong&gt; and &lt;strong&gt;verison&lt;/strong&gt;, which includes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MariaDB&lt;/li&gt;
&lt;li&gt;Microsoft SQL Server&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;li&gt;Oracle&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;After creating the RDS, you can check the connection details such as &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt; as well as the &lt;strong&gt;Endpoint&lt;/strong&gt; and &lt;strong&gt;port&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;h2&gt;
  
  
  RDS Connection and SQL Query
&lt;/h2&gt;

&lt;p&gt;We can connect RDS for PostgreSQL via &lt;strong&gt;pgAdmin, psql, or programming language&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connecting RDS for PostgreSQL via Python&lt;/li&gt;
&lt;li&gt;Create and List the table within the database&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remark:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;when you connect the RDS via &lt;strong&gt;public internet&lt;/strong&gt;, you need to &lt;strong&gt;allow public access&lt;/strong&gt; in RDS and configure the &lt;strong&gt;security group for allowed port and source IP&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import psycopg2
engine = psycopg2.connect(
    database="postgres",
    user="postgres",
    password="HvNnP1UnYVtNZS15ofUf",
    host="database-1.cjylreq9cdvs.ap-east-1.rds.amazonaws.com",
    port='5432'
)
cursor = engine.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS Persons (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255)
);
               ''')
cursor.execute('''
select relname from pg_class where relkind='r' and relname !~ '^(pg_|sql_)';
''')
print("The RDS postgres database contains the following table:")
print(cursor.fetchall())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h2&gt;
  
  
  Backup and Restore
&lt;/h2&gt;

&lt;p&gt;By default, RDS is enabled with &lt;strong&gt;automated backups&lt;/strong&gt; and &lt;strong&gt;backup retention period&lt;/strong&gt; (e.g. 7 days). If you have some significant change on RDS Database, you can manually &lt;strong&gt;take the snapshot&lt;/strong&gt; for restoration purpose.&lt;/p&gt;

&lt;p&gt;When you select the snapshot, you can restore the database back to that specific time of status.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  High Availablity &amp;amp; Disaster Recovery
&lt;/h2&gt;

&lt;p&gt;You can create the &lt;strong&gt;read replicas&lt;/strong&gt; in another availablity zone for better availablity while the read replicas only allow read database data. Once the primary RDS instance is down, you can promote the read replicas to be the primary RDS.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Recovery time objective (RTO)&lt;/th&gt;
&lt;th&gt;Recovery point objective (RPO)&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Automated backups&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Better&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Single Region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manual snapshots&lt;/td&gt;
&lt;td&gt;Better&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Cross-Region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read replicas&lt;/td&gt;
&lt;td&gt;Best&lt;/td&gt;
&lt;td&gt;Best&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Cross-Region&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

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

&lt;p&gt;Reference:&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html"&gt;https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Concepts.on-prem"&gt;https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Concepts.on-prem&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html"&gt;https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/tw/rds/features/backup/"&gt;https://aws.amazon.com/tw/rds/features/backup/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html"&gt;https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/tw/blogs/database/implementing-a-disaster-recovery-strategy-with-amazon-rds/"&gt;https://aws.amazon.com/tw/blogs/database/implementing-a-disaster-recovery-strategy-with-amazon-rds/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>AWS Storage Comparison: EBS vs S3 vs EFS vs FSx</title>
      <dc:creator>Lam Wing Chun</dc:creator>
      <pubDate>Sun, 09 Jul 2023 03:25:49 +0000</pubDate>
      <link>https://dev.to/oscaroscarlam/comparison-between-ebs-vs-efs-vs-s3-4p2n</link>
      <guid>https://dev.to/oscaroscarlam/comparison-between-ebs-vs-efs-vs-s3-4p2n</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KwyIWdj5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnzuwcleimlormthxrut.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KwyIWdj5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnzuwcleimlormthxrut.jpg" alt="Image description" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we are going to understand the common types of storage options on AWS, which include Simple Storage Service (S3), Elastic Block Store (EBS), Elastic File System (EFS), and Amazon FSx.&lt;/p&gt;

&lt;p&gt;Firstly, when we deploy EC2, we need a disk storage for storing the EC2 Operating system file and temp cache file to be able to start running the EC2 instance and we can call this type of disk as a OS Disk. Depending on user practice, we can expend the OS disk size or attach the additional disks for more disk storage. &lt;/p&gt;

&lt;p&gt;While the file in the disk storage can be accessed by the attached EC2, it may be inconvenient for other EC2 to access. In this case, we may prefer to use S3 bucket or Elastic File System (EFS) for better file sharing purpose.&lt;/p&gt;

&lt;p&gt;For the Elastic File System (EFS), it will support cross-VPC EC2 or single VPC EC2 file drive mounting as Network Attached Storage (NAS). For the cross-VPC mounting, it requires the VPC peering. &lt;/p&gt;

&lt;p&gt;In some case, using S3 as file sharing can be less troublesome. However, EFS outpreform S3 in term of file access speed and user firendliness.&lt;/p&gt;

&lt;p&gt;Since Elastic File System (EFS) only support Linux-based file system, if we want to mount the NAS to Windows-based EC2, we need to use Amazon FSx for Windows File Server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Storage Service (S3)
&lt;/h2&gt;

&lt;p&gt;During the creation of S3 bucket, you are only required to select the region to deploy the bucket&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8LK1qZTY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9b6kjyib400wb9m7a7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8LK1qZTY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9b6kjyib400wb9m7a7e.png" alt="Image description" width="800" height="774"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you upload the file to S3, you can determine which storage class the file belongs to.&lt;/p&gt;

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

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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Storage class&lt;/th&gt;
&lt;th&gt;Designed for&lt;/th&gt;
&lt;th&gt;Availability Zones&lt;/th&gt;
&lt;th&gt;Min storage duration&lt;/th&gt;
&lt;th&gt;Min billable object size&lt;/th&gt;
&lt;th&gt;Monitoring and auto-tiering fees&lt;/th&gt;
&lt;th&gt;Retrieval fees&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;Frequently accessed data (more than once a month) with milliseconds access&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Intelligent-Tiering&lt;/td&gt;
&lt;td&gt;Data with changing or unknown access patterns&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-object fees apply for objects &amp;gt;= 128 KB&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard-IA&lt;/td&gt;
&lt;td&gt;Infrequently accessed data (once a month) with milliseconds access&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One Zone-IA&lt;/td&gt;
&lt;td&gt;Recreatable, infrequently accessed data (once a month) stored in a single Availability Zone with milliseconds access&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Instant Retrieval&lt;/td&gt;
&lt;td&gt;Long-lived archive data accessed once a quarter with instant retrieval in milliseconds&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Flexible Retrieval (formerly Glacier)&lt;/td&gt;
&lt;td&gt;Long-lived archive data accessed once a year with retrieval of minutes to hours&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Deep Archive&lt;/td&gt;
&lt;td&gt;Long-lived archive data accessed less than once a year with retrieval of hours&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;180 days&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reduced redundancy&lt;/td&gt;
&lt;td&gt;Noncritical, frequently accessed data with milliseconds access (not recommended as S3 Standard is more cost effective)&lt;/td&gt;
&lt;td&gt;≥ 3&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Per-GB fees apply&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Elastic Block Store (EBS)
&lt;/h2&gt;

&lt;p&gt;In EC2 console, you can create &lt;strong&gt;EBS Volume&lt;/strong&gt; for attaching to EC2. When you create it, you can select the different Volume types and provisioned storage size&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1XLIumYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlfsq7s3wgy31sw1ij6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1XLIumYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlfsq7s3wgy31sw1ij6t.png" alt="Image description" width="800" height="759"&gt;&lt;/a&gt;&lt;br&gt;
Or specify the &lt;strong&gt;EBS Volume&lt;/strong&gt; when creating EC2 instance.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rc6ceiUZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/599zvcfkg7hfxw2r9bxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rc6ceiUZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/599zvcfkg7hfxw2r9bxp.png" alt="Image description" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Solid state drive (SSD) volumes&lt;/th&gt;
&lt;th&gt;Volume type&lt;/th&gt;
&lt;th&gt;Durability&lt;/th&gt;
&lt;th&gt;Use cases&lt;/th&gt;
&lt;th&gt;Volume size&lt;/th&gt;
&lt;th&gt;Max IOPS per volume (16 KiB I/O)&lt;/th&gt;
&lt;th&gt;Max throughput per volume&lt;/th&gt;
&lt;th&gt;Amazon EBS Multi-attach&lt;/th&gt;
&lt;th&gt;Boot volume&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;General Purpose SSD volumes&lt;/td&gt;
&lt;td&gt;gp3&lt;/td&gt;
&lt;td&gt;99.8% - 99.9% durability&lt;br&gt;(0.1% - 0.2% annual failure rate)&lt;/td&gt;
&lt;td&gt;Transactional workloads&lt;br&gt;Virtual desktops&lt;br&gt;Medium-sized, single-instance databases&lt;br&gt;Low-latency interactive applications&lt;br&gt;Boot volumes&lt;br&gt;Development and test environments&lt;/td&gt;
&lt;td&gt;1 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;16,000&lt;/td&gt;
&lt;td&gt;1,000 MiB/s&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;General Purpose SSD volumes&lt;/td&gt;
&lt;td&gt;gp2&lt;/td&gt;
&lt;td&gt;99.8% - 99.9% durability&lt;br&gt;(0.1% - 0.2% annual failure rate)&lt;/td&gt;
&lt;td&gt;Transactional workloads&lt;br&gt;Virtual desktops&lt;br&gt;Medium-sized, single-instance databases&lt;br&gt;Low-latency interactive applications&lt;br&gt;Boot volumes&lt;br&gt;Development and test environments&lt;/td&gt;
&lt;td&gt;2 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;16,000&lt;/td&gt;
&lt;td&gt;250 MiB/s *&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Provisioned IOPS SSD volumes&lt;/td&gt;
&lt;td&gt;io2 Block Express ‡&lt;/td&gt;
&lt;td&gt;99.999% durability&lt;br&gt;(0.001% annual failure rate)&lt;/td&gt;
&lt;td&gt;Workloads that require:&lt;br&gt;Sub-millisecond latency&lt;br&gt;Sustained IOPS performance&lt;br&gt;More than 64,000 IOPS or 1,000 MiB/s of throughput&lt;/td&gt;
&lt;td&gt;4 GiB - 64 TiB&lt;/td&gt;
&lt;td&gt;256,000&lt;/td&gt;
&lt;td&gt;4,000 MiB/s&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Provisioned IOPS SSD volumes&lt;/td&gt;
&lt;td&gt;io2&lt;/td&gt;
&lt;td&gt;99.999% durability&lt;br&gt;(0.001% annual failure rate)&lt;/td&gt;
&lt;td&gt;Workloads that require sustained IOPS performance or more than 16,000 IOPS&lt;br&gt;I/O-intensive database workloads&lt;/td&gt;
&lt;td&gt;4 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;64,000 †&lt;/td&gt;
&lt;td&gt;1,000 MiB/s †&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Provisioned IOPS SSD volumes&lt;/td&gt;
&lt;td&gt;io1&lt;/td&gt;
&lt;td&gt;99.8% - 99.9% durability&lt;br&gt;(0.1% - 0.2% annual failure rate)&lt;/td&gt;
&lt;td&gt;Workloads that require sustained IOPS performance or more than 16,001 IOPS&lt;br&gt;I/O-intensive database workloads&lt;/td&gt;
&lt;td&gt;5 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;64,001 †&lt;/td&gt;
&lt;td&gt;1,001 MiB/s †&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hard Disk Drive (HDD) volumes&lt;/th&gt;
&lt;th&gt;Volume type&lt;/th&gt;
&lt;th&gt;Durability&lt;/th&gt;
&lt;th&gt;Use cases&lt;/th&gt;
&lt;th&gt;Volume size&lt;/th&gt;
&lt;th&gt;Max IOPS per volume (1 MiB I/O)&lt;/th&gt;
&lt;th&gt;Max throughput per volume&lt;/th&gt;
&lt;th&gt;Amazon EBS Multi-attach&lt;/th&gt;
&lt;th&gt;Boot volume&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Throughput Optimized HDD volumes&lt;/td&gt;
&lt;td&gt;st1&lt;/td&gt;
&lt;td&gt;99.8% - 99.9% durability&lt;br&gt;(0.1% - 0.2% annual failure rate)&lt;/td&gt;
&lt;td&gt;Big data&lt;br&gt;Data warehouses&lt;br&gt;Log processing&lt;/td&gt;
&lt;td&gt;125 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;td&gt;500 MiB/s&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cold HDD volumes&lt;/td&gt;
&lt;td&gt;sc1&lt;/td&gt;
&lt;td&gt;99.8% - 99.9% durability&lt;br&gt;(0.1% - 0.2% annual failure rate)&lt;/td&gt;
&lt;td&gt;Throughput-oriented storage for data that is infrequently accessed&lt;br&gt;Scenarios where the lowest storage cost is important&lt;/td&gt;
&lt;td&gt;125 GiB - 16 TiB&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;td&gt;250 MiB/s&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Previous generation volumes&lt;/th&gt;
&lt;th&gt;Volume type&lt;/th&gt;
&lt;th&gt;Use cases&lt;/th&gt;
&lt;th&gt;Volume size&lt;/th&gt;
&lt;th&gt;Max IOPS per volume&lt;/th&gt;
&lt;th&gt;Max throughput per volume&lt;/th&gt;
&lt;th&gt;Boot volume&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Magnetic&lt;/td&gt;
&lt;td&gt;standard&lt;/td&gt;
&lt;td&gt;Workloads where data is infrequently accessed&lt;/td&gt;
&lt;td&gt;1 GiB-1 TiB&lt;/td&gt;
&lt;td&gt;40–200&lt;/td&gt;
&lt;td&gt;40–90 MiB/s&lt;/td&gt;
&lt;td&gt;Supported&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Elastic File System (EFS)
&lt;/h2&gt;

&lt;p&gt;When creating EFS, you need to specify the VPC for deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FROtBHaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3m98zqmd5l8hm29swtu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FROtBHaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3m98zqmd5l8hm29swtu.png" alt="Image description" width="625" height="467"&gt;&lt;/a&gt;&lt;br&gt;
After the EFS deployment, you can change the performance setting to elastic or provisioned. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NRfeuQ13--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmn1kns3175vh53lr7r8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NRfeuQ13--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmn1kns3175vh53lr7r8.png" alt="Image description" width="800" height="367"&gt;&lt;/a&gt;&lt;br&gt;
you can run the following commands provided by EFS on Linux EC2 to mount the Network Attached Storage (NAS). &lt;strong&gt;Unfortunately, Amazon EFS does not support mounting from Amazon EC2 Windows instances.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the EFS mount helper:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mount -t efs -o tls fs-04de9a52fae17a3e2:/ efs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using the NFS client:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-04de9a52fae17a3e2.efs.ap-east-1.amazonaws.com:/ efs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Storage class&lt;/th&gt;
&lt;th&gt;Designed for&lt;/th&gt;
&lt;th&gt;Durability (designed for)&lt;/th&gt;
&lt;th&gt;Availability&lt;/th&gt;
&lt;th&gt;Availability zones&lt;/th&gt;
&lt;th&gt;Other considerations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EFS Standard&lt;/td&gt;
&lt;td&gt;Frequently accessed data requiring the highest durability and availability.&lt;/td&gt;
&lt;td&gt;99.999999999% (11 9's)&lt;/td&gt;
&lt;td&gt;99.99%&lt;/td&gt;
&lt;td&gt;&amp;gt;=3&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EFS Standard–Infrequent Access (IA)&lt;/td&gt;
&lt;td&gt;Long lived, infrequently accessed data requiring the highest durability and availability.&lt;/td&gt;
&lt;td&gt;99.999999999% (11 9's)&lt;/td&gt;
&lt;td&gt;99.99%&lt;/td&gt;
&lt;td&gt;&amp;gt;=3&lt;/td&gt;
&lt;td&gt;Per GB retrieval fees apply.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EFS One Zone&lt;/td&gt;
&lt;td&gt;Frequently accessed data that doesn’t require highest levels of durability and availability.&lt;/td&gt;
&lt;td&gt;99.999999999% (11 9's)*&lt;/td&gt;
&lt;td&gt;99.90%&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Not resilient to the loss of the Availability Zone.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EFS One Zone-IA&lt;/td&gt;
&lt;td&gt;Long lived, infrequently accessed data that doesn’t require highest levels of durability and availability.&lt;/td&gt;
&lt;td&gt;99.999999999% (11 9's)*&lt;/td&gt;
&lt;td&gt;99.90%&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Not resilient to the loss of the Availability Zone. Per GB retrieval fees apply.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Amazon FSx
&lt;/h2&gt;

&lt;p&gt;you need to joins the Windows EC2 instance to your AWS Managed Microsoft AD directory&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o4ETD5FZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtixj2oq4iprll239ldg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o4ETD5FZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtixj2oq4iprll239ldg.png" alt="Image description" width="800" height="693"&gt;&lt;/a&gt;&lt;br&gt;
After joining EC2 to the domain/directory, you can run the following commands to mount the NAS to windows EC2&lt;/p&gt;

&lt;p&gt;you can replace "Z:" with any other available drive letter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//using the default DNS name
net use Z: \\\share
//using DNS aliases
net use Z: \\alias\share
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Reference:&lt;br&gt;
&lt;a href="https://aws.amazon.com/tw/s3/pricing/?nc=sn&amp;amp;loc=4"&gt;https://aws.amazon.com/tw/s3/pricing/?nc=sn&amp;amp;loc=4&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/tw/ebs/pricing/"&gt;https://aws.amazon.com/tw/ebs/pricing/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/tw/efs/pricing/"&gt;https://aws.amazon.com/tw/efs/pricing/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/general-purpose.html"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/general-purpose.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/provisioned-iops.html"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/provisioned-iops.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hdd-vols.html"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hdd-vols.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html"&gt;https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-wfsx-volumes.html"&gt;https://docs.aws.amazon.com/AmazonECS/latest/developerguide/tutorial-wfsx-volumes.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/directoryservice/latest/admin-guide/launching_instance.html"&gt;https://docs.aws.amazon.com/directoryservice/latest/admin-guide/launching_instance.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>[Step-by-Step] How to import/export EC2 Image from/to S3 bucket</title>
      <dc:creator>Lam Wing Chun</dc:creator>
      <pubDate>Fri, 07 Jul 2023 07:25:10 +0000</pubDate>
      <link>https://dev.to/oscaroscarlam/step-by-step-how-to-importexport-ec2-image-fromto-s3-bucket-pc9</link>
      <guid>https://dev.to/oscaroscarlam/step-by-step-how-to-importexport-ec2-image-fromto-s3-bucket-pc9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;While there are plenty of Virtual Machine Image available in EC2 and AWS Marketplace, sometime there is a need to set up the custom virtual machine image such as server migration and autoscaling template. &lt;/p&gt;

&lt;p&gt;In such case, when the source images are from other platforms such as VMware vCenter, Hyper-V, and other cloud platforms, we need an approach to upload the virtual machine image. At the same time, we need to export the virtual machine image from EC2 and download it to our on-premises environment for backup and other reasons. In this tutorial, we are going to import/export EC2 Image from/to S3 bucket.&lt;/p&gt;

&lt;p&gt;For Importing EC2 Image from S3 bucket, we first upload the source virtual machine image to S3 bucket. After that, we will use the EC2 Image Builder to create the custom virtual machine image and register it as AMI for EC2 to deploy.&lt;/p&gt;

&lt;p&gt;For Exporting EC2 Image to S3 bucket, when we have made some configuration changes in EC2 and we want to export it, we will use the AWS CLI export-image command to export the image to S3 bucket and we can download it once it is ready.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remark:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When downloading files from S3 bucket to on-premises, there will be the data transfer charge based on the amount of data. 
&lt;strong&gt;[First 100GB of data transfer out to the internet free each month]&lt;/strong&gt; &lt;a href="https://aws.amazon.com/s3/pricing/" rel="noopener noreferrer"&gt;https://aws.amazon.com/s3/pricing/&lt;/a&gt;
&lt;a href="https://aws.amazon.com/blogs/architecture/overview-of-data-transfer-costs-for-common-architectures/" rel="noopener noreferrer"&gt;https://aws.amazon.com/blogs/architecture/overview-of-data-transfer-costs-for-common-architectures/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AMI Operating Systems List for AWS EC2:
&lt;a href="https://aws.amazon.com/marketplace/b/c3bc6a75-0c3a-46ce-8fdd-498b6fd88577?ref_=hmpg_categories_c3bc6a75-0c3a-46ce-8fdd-498b6fd88577&amp;amp;category=c3bc6a75-0c3a-46ce-8fdd-498b6fd88577" rel="noopener noreferrer"&gt;https://aws.amazon.com/marketplace/b/c3bc6a75-0c3a-46ce-8fdd-498b6fd88577?ref_=hmpg_categories_c3bc6a75-0c3a-46ce-8fdd-498b6fd88577&amp;amp;category=c3bc6a75-0c3a-46ce-8fdd-498b6fd88577&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step Summary
&lt;/h2&gt;

&lt;p&gt;Step 1: Create IAM Role for importing and Exporting EC2 Image&lt;br&gt;
Step 2: Create S3 bucket for storing the EC2 Image File.&lt;/p&gt;

&lt;h4&gt;
  
  
  For Importing EC2 Image from S3 bucket:
&lt;/h4&gt;

&lt;p&gt;Step 3: Uploading the Image to S3&lt;br&gt;
Step 4: Create AMI Image via EC2 Image Builder&lt;/p&gt;

&lt;h4&gt;
  
  
  For Exporting EC2 Image to S3 bucket:
&lt;/h4&gt;

&lt;p&gt;Step 5: Start the EC2 image exporting task via AWS CloudShell&lt;br&gt;
Step 6: Downloading the Image from S3&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Details
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create IAM Role for importing and Exporting EC2 Image
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;IAM&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmef1d3sao295hy15elpa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmef1d3sao295hy15elpa.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Go to &lt;strong&gt;Roles&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi9mv5ycpiv55g7e322c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi9mv5ycpiv55g7e322c.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;strong&gt;Create Role&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm3893xiqyk7l2m8ua66.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm3893xiqyk7l2m8ua66.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Select &lt;strong&gt;Custom trust policy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm01cha7hgcxu76dmenq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm01cha7hgcxu76dmenq9.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Copy the following trust policy to the policy editor and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;/p&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",
         "Principal": { "Service": "vmie.amazonaws.com" },
         "Action": "sts:AssumeRole",
         "Condition": {
            "StringEquals":{
               "sts:Externalid": "vmimport"
            }
         }
      }
   ]
}


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

&lt;/div&gt;

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

&lt;p&gt;Press &lt;strong&gt;Create Policy&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Copy the following IAM policy to the policy editor &lt;br&gt;
Press &lt;strong&gt;Next&lt;/strong&gt;&lt;/p&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": [
            "s3:GetBucketLocation",
            "s3:GetObject",
            "s3:ListBucket",
            "s3:PutObject",
            "s3:GetBucketAcl"
         ],
         "Resource": "*"
      },
      {
         "Effect": "Allow",
         "Action": [
            "ec2:ModifySnapshotAttribute",
            "ec2:CopySnapshot",
            "ec2:RegisterImage",
            "ec2:Describe*"
         ],
         "Resource": "*"
      }
   ]
}


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

&lt;/div&gt;

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

&lt;p&gt;Name the IAM policy and Press &lt;strong&gt;Create Policy&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;p&gt;Select the created IAM Policy and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0n5t82y8sezc1d8tml9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0n5t82y8sezc1d8tml9.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Name the IAM Role and Press &lt;strong&gt;Create Role&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;p&gt;Now, you have created the IAM Role for importing and Exporting EC2 Image&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 2: Create S3 bucket for storing the EC2 Image File.
&lt;/h3&gt;

&lt;p&gt;Go to S3&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11h0zk1gs9jjazkc7dnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11h0zk1gs9jjazkc7dnc.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;strong&gt;Create bucket&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Name the S3 bucket and select the region&lt;/p&gt;

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

&lt;p&gt;Disable &lt;strong&gt;Block all public access&lt;/strong&gt; and acknowledge it&lt;/p&gt;

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

&lt;p&gt;Press &lt;strong&gt;Create bucket&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F66peiecgag5uvhuvk2g7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F66peiecgag5uvhuvk2g7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you have created the S3 bucket for storing the EC2 Image File&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xgeke9jwnfzrlw9lw6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8xgeke9jwnfzrlw9lw6k.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For Importing EC2 Image from S3 bucket:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 3: Uploading the Image to S3
&lt;/h3&gt;

&lt;p&gt;In this tutorial, Ubuntu 18.04 LTS (Bionic Beaver) VMware VMDK Image File is selected as the EC2 Image file&lt;/p&gt;

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

&lt;p&gt;Donwload Link: &lt;a href="https://cloud-images.ubuntu.com/bionic/current/" rel="noopener noreferrer"&gt;https://cloud-images.ubuntu.com/bionic/current/&lt;/a&gt;&lt;br&gt;
Go to the created S3 bucket&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbece1owawj0kld2vp3p9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbece1owawj0kld2vp3p9.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;strong&gt;Upload&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpin4dn6hstssp51x2afx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpin4dn6hstssp51x2afx.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;strong&gt;Add files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2wosb83o30wywnbuivz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2wosb83o30wywnbuivz.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Select the downloaded VMDK file&lt;/p&gt;

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

&lt;p&gt;Press &lt;strong&gt;Upload&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Now, you have uploaded the image file to the S3 bucket&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 4: Create AMI Image via EC2 Image Builder
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;EC2 Image Builder&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Go to &lt;strong&gt;Images&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa90fj8khshx11kai35q5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa90fj8khshx11kai35q5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;Import Image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl3a0zosxnrdsdj7u7kv1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl3a0zosxnrdsdj7u7kv1.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Name the EC2 Image and Version&lt;/p&gt;

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

&lt;p&gt;Select the nearest base image operating system&lt;/p&gt;

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

&lt;p&gt;Browse S3 to select the uploaded Image file&lt;/p&gt;

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

&lt;p&gt;Select the created IAM Role and Press &lt;strong&gt;Import Image&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Once the import image task has finished, we can see the EC2 image in AMI.&lt;/p&gt;

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

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

&lt;p&gt;Go to AMIs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpok2kv573i0v5w33mudz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpok2kv573i0v5w33mudz.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
In this page, you can see the created EC2 Image and you can deploy the EC2 Image by pressing &lt;strong&gt;Launch instance from AMI&lt;/strong&gt;&lt;/p&gt;

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

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

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

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

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

&lt;h2&gt;
  
  
  For Exporting EC2 Image to S3 bucket:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 5: Start the EC2 image exporting task via AWS CloudShell
&lt;/h3&gt;

&lt;p&gt;After changing or deploying some application and configuration in the EC2, we can export it to S3 to back up the current application and configuration status of the virtual machine image.&lt;/p&gt;

&lt;p&gt;Select the EC2 Instance and Press &lt;strong&gt;Create Image&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhf6dpafvhl8708mp723.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhf6dpafvhl8708mp723.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Name the AMI Image and Press &lt;strong&gt;Create Image&lt;/strong&gt;&lt;/p&gt;

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

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

&lt;p&gt;Now. you have created the new AMI Image from EC2&lt;/p&gt;

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

&lt;p&gt;In order to export the AMI Image to S3, we are going to use the AWS Cloudshell&lt;br&gt;
Go to AWS Cloudshell&lt;/p&gt;

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

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

&lt;p&gt;Copy the IAM Role Name (role-name), the AMI id from the created AMI image (image-id) and the S3 Name (s3-export-location) as follows:&lt;/p&gt;

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

aws ec2 export-image \
--role-name EC2ImageImportExportRole \
--image-id ami-0dbeabfbb124c3ae5 \
--disk-image-format VMDK \
--s3-export-location S3Bucket=ec2imagebucketstorage123,\
S3Prefix=exports/


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

&lt;/div&gt;

&lt;p&gt;Paste it in AWS Cloudshell&lt;/p&gt;

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

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

&lt;p&gt;While we can monitor the exporting task by using the following command (export-image-task-ids)&lt;br&gt;
(export-image-task-ids) can be found in ExportImageTaskId Value in the above JSON response when starting the export task&lt;/p&gt;

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

aws ec2 describe-export-image-tasks \
--export-image-task-ids export-ami-0510f25de97082fe0


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

&lt;/div&gt;

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

&lt;h3&gt;
  
  
  Step 6: Downloading the Image from S3
&lt;/h3&gt;

&lt;p&gt;Once the EC2 Image has exported, you can find it in the S3 Bucket&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh0ufq76fbyretduknw78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh0ufq76fbyretduknw78.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;exports/&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9praakkut52ipatq7o8q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9praakkut52ipatq7o8q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the exported EC2 Image and Press &lt;strong&gt;Download&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijs7tefph7p4scuvm5io.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijs7tefph7p4scuvm5io.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport_image.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport_image.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/cloudshell/latest/userguide/supported-aws-regions.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/cloudshell/latest/userguide/supported-aws-regions.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/export-image.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/cli/latest/reference/ec2/export-image.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>aws</category>
      <category>beginners</category>
    </item>
    <item>
      <title>[Step-by-Step] How to start &amp; stop AWS EC2 automatically using Lambda &amp; EventBridge</title>
      <dc:creator>Lam Wing Chun</dc:creator>
      <pubDate>Mon, 03 Jul 2023 16:21:43 +0000</pubDate>
      <link>https://dev.to/oscaroscarlam/step-by-step-how-to-start-stop-aws-ec2-automatically-using-lambda-eventbridge-40pm</link>
      <guid>https://dev.to/oscaroscarlam/step-by-step-how-to-start-stop-aws-ec2-automatically-using-lambda-eventbridge-40pm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we are going to automate starting and stopping EC2 via Lambda &amp;amp; EventBridge at regular intervals (e.g.running EC2 from 8:00 am to 8:00 pm). While the EC2 is stopped, we can save the compute cost during this time. &lt;/p&gt;

&lt;p&gt;In order to let Lambda be able to start and stop the EC2 instance, we first need to assign the required IAM permission for lambda in Step1. &lt;/p&gt;

&lt;p&gt;Once it is done, we can create two lambda functions, which the first one is for starting the EC2 and the second one is for stopping the EC2. After that, we can create the EventBridge Schedule to trigger the lambda function at the desired times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Summary:
&lt;/h2&gt;

&lt;p&gt;Step 1: Create IAM role for Lambda&lt;br&gt;
Step 2: Create 2 Lambda function for starting and stopping EC2&lt;br&gt;
Step 3: Create 2 EventBridge Schedule to invoke 2 Lambda functions&lt;/p&gt;
&lt;h2&gt;
  
  
  Step Details:
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Step 1: Create IAM role for Lambda:
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;IAM&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnlas0s2fto4iz8ljbp5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnlas0s2fto4iz8ljbp5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;Role&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte35uk69689gymwx9aom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte35uk69689gymwx9aom.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;Create Role&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllbdfxh9wkru20ftgwqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllbdfxh9wkru20ftgwqm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;AWS Service&lt;/strong&gt; and &lt;strong&gt;Lambda&lt;/strong&gt; and press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6uivd25l82ctpqf9svx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6uivd25l82ctpqf9svx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;Create Policy&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bh2x9gwvcutj2xhaoas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bh2x9gwvcutj2xhaoas.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;JSON&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8prib2bmrc2oxy3sm1us.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8prib2bmrc2oxy3sm1us.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the following IAM Policy and paste in JSON Editor&lt;br&gt;
&lt;/p&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": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "arn:aws:logs:*:*:*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "ec2:Start*",
        "ec2:Stop*"
      ],
      "Resource": "*"
    }, 
    {
      "Effect": "Allow",
      "Action": [
          "ses:SendEmail",
          "ses:SendRawEmail"
      ],
      "Resource": "*"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go Back to &lt;strong&gt;Visual&lt;/strong&gt; and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5o2mocym0ogfcpjehtm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5o2mocym0ogfcpjehtm7.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnxhth063ls9ncpzumje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnxhth063ls9ncpzumje.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Name the IAM Policy and Press &lt;strong&gt;Create Policy&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnne5jg7rv7zmhnlp3q92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnne5jg7rv7zmhnlp3q92.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft42mue7ios6dxwa094zv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft42mue7ios6dxwa094zv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the created IAM Policy and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe52gg6ol6n05f6rfpie2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe52gg6ol6n05f6rfpie2.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9076e3tyd4fzur0pe7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9076e3tyd4fzur0pe7l.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Name the IAM Role and Press &lt;strong&gt;Create Role&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuoiyq0cegpuzb46z7i9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuoiyq0cegpuzb46z7i9t.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98uauerhk19xidcfqx9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98uauerhk19xidcfqx9a.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now, you have created the IAM Role for Lambda&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtsmf1m2mbniuyt4i4qw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtsmf1m2mbniuyt4i4qw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Create 2 Lambda function for starting and stopping EC2
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;Lambda&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Press &lt;strong&gt;Create Function&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4447kqrgv8a5b7l4dw73.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4447kqrgv8a5b7l4dw73.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Author from scratch&lt;/strong&gt; and Name the Lamdba function&lt;br&gt;
Select &lt;strong&gt;Python 3.9&lt;/strong&gt; runtime and Select IAM Role for Lambda&lt;br&gt;
Press &lt;strong&gt;Create function&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllaikqv8lzf57gc4dyaj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllaikqv8lzf57gc4dyaj.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Modify the following Python Code and paste in Code source Editor&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AutoStartEC2&lt;/strong&gt;&lt;br&gt;
Replace 'ap-east-1' to the designated Region for your situation&lt;br&gt;
Replace 'i-0f7f94a56f47e7221' to the EC2 ID&lt;br&gt;
you can add more instances in this array if you want&lt;br&gt;
E.g. ['i-0f7f94a56f47e7221','i-0uweq7w7d7293','i-0wwq78e78we781']&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import boto3
/////////////////////////////////////////////////////
region = 'ap-east-1'
instances = ['i-0f7f94a56f47e7221']
/////////////////////////////////////////////////////
ec2 = boto3.client('ec2', region_name=region)
def lambda_handler(event, context):
    ec2.start_instances(InstanceIds=instances)
    print('started your instances: ' + str(instances))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press &lt;strong&gt;Deploy&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9i6bctc2kzzjvkpxjb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9i6bctc2kzzjvkpxjb7.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Now, you have created the lambda function for starting EC2&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6xx75yq5bgt0p0atdv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6xx75yq5bgt0p0atdv8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repeat the above steps and refer to the following code to create the lambda function for stopping EC2&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AutoStopEC2&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import boto3
/////////////////////////////////////////////////////
region = 'ap-east-1'
instances = ['i-0f7f94a56f47e7221']
/////////////////////////////////////////////////////
ec2 = boto3.client('ec2', region_name=region)
def lambda_handler(event, context):
    ec2.stop_instances(InstanceIds=instances)
    print('stopped your instances: ' + str(instances))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Step 3: Create 2 EventBridge Schedule to invoke 2 Lambda functions
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;EventBridge&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj72jnuwhisusla8zzf30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj72jnuwhisusla8zzf30.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;EventBridge Schedule&lt;/strong&gt; and Press &lt;strong&gt;Create schedule&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Name the &lt;strong&gt;EventBridge Schedule&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Select &lt;strong&gt;Recurring schedule&lt;/strong&gt; and &lt;strong&gt;Cron-based schedule&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Define the cron expression for the schedule&lt;br&gt;
cron(minutes hours day-of-month month day-of-week year)&lt;/p&gt;

&lt;p&gt;For our cron expression, it will run at 8:00 am from Monday to Firday every week every year&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Off&lt;/strong&gt; in &lt;strong&gt;Flexible time window&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75nugf0e367thd3ewmu4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75nugf0e367thd3ewmu4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Timezone&lt;/strong&gt; and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23tqspevy1jiyruz68gn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23tqspevy1jiyruz68gn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Lambda&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnwijrudzy2k3mxrhulz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnwijrudzy2k3mxrhulz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Lambda Function&lt;/strong&gt; and Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc7nna5yjbg0myje8xkrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc7nna5yjbg0myje8xkrz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;Next&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrnnmzusjrjkb84w1w2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrnnmzusjrjkb84w1w2c.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm55jhqle1xqjn8zlh4n0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm55jhqle1xqjn8zlh4n0.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Press &lt;strong&gt;Create schedule&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Now, you have created the EventBridge Schedule for triggering lambda to start EC2&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pcdccfasiouqk2vkeiw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pcdccfasiouqk2vkeiw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repeat the above steps and Change the cron expression from 8 to 20 and select the AutoStopEC2 lambda function to create EventBridge Schedule for triggering lambda to stop EC2&lt;/p&gt;

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

&lt;p&gt;Reference:&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html?icmpid=docs_console_unmapped#cron-based" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html?icmpid=docs_console_unmapped#cron-based&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/lambda/pricing/?nc1=h_ls" rel="noopener noreferrer"&gt;https://aws.amazon.com/lambda/pricing/?nc1=h_ls&lt;/a&gt;&lt;br&gt;
&lt;a href="https://repost.aws/knowledge-center/start-stop-lambda-eventbridge" rel="noopener noreferrer"&gt;https://repost.aws/knowledge-center/start-stop-lambda-eventbridge&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.amazonaws.cn/en/eventbridge/pricing/#:%7E:text=With%20Amazon%20EventBridge%2C%20you%20pay%20only%20for%20events,price%20is%20%C2%A5%206.75%20per%201%20million%20events" rel="noopener noreferrer"&gt;https://www.amazonaws.cn/en/eventbridge/pricing/#:~:text=With%20Amazon%20EventBridge%2C%20you%20pay%20only%20for%20events,price%20is%20%C2%A5%206.75%20per%201%20million%20events&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>aws</category>
    </item>
    <item>
      <title>hi</title>
      <dc:creator>Lam Wing Chun</dc:creator>
      <pubDate>Fri, 01 Jul 2022 13:39:11 +0000</pubDate>
      <link>https://dev.to/oscaroscarlam/hi-334f</link>
      <guid>https://dev.to/oscaroscarlam/hi-334f</guid>
      <description></description>
    </item>
  </channel>
</rss>
