{"id":636,"date":"2023-06-20T18:11:40","date_gmt":"2023-06-20T09:11:40","guid":{"rendered":"https:\/\/www.bees-team.com\/?p=636"},"modified":"2023-06-20T18:11:40","modified_gmt":"2023-06-20T09:11:40","slug":"launching-aws-ec2-instance-using-python","status":"publish","type":"post","link":"https:\/\/www.bees-team.com\/?p=636","title":{"rendered":"Launching AWS EC2 Instance using Python"},"content":{"rendered":"<div class=\"post-content\"><div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>3 Minute, 54 Second                <\/div>\n\n            <\/div><p>In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).<\/p>\n<h3><strong>Prerequisites:<\/strong><\/h3>\n<ul>\n<li>AWS account with privileges<\/li>\n<li>Basics of\u00a0<a href=\"https:\/\/www.geeksforgeeks.org\/what-is-elastic-compute-cloud-ec2\/\">EC2<\/a><\/li>\n<\/ul>\n<p>For installing boto3 in python :<\/p>\n<pre>default version : pip install boto3\r\nspecific version : python3 -m pip install boto3 (as python3 in this case)<\/pre>\n<h3>Setting Up the AWS EC2 Console:<\/h3>\n<p>For accessing the AWS services from python code we first need to create a user and give him programmatic access using Amazon console.<\/p>\n<ul>\n<li>Launch\u00a0<a href=\"https:\/\/console.aws.amazon.com\/iam\/home#\/users\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">IAM<\/a>\u00a0console<\/li>\n<li>Add user<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723023139\/Screenshotfrom20200723021931.png\" alt=\"add user in IAM console\" \/><\/p>\n<ul>\n<li>Then provide a username and give programmatic access to it and then click Next.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723023607\/2.png\" \/><\/p>\n<ul>\n<li>Now provide the necessary permission related to the user, \u00a0this user might belong to a group and their policies can be directly attached to the user, or we can copy the policies of an existing user, or we can directly attach an existing policy as we are going to provide here.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723024822\/Screenshotfrom20200723024716.png\" alt=\"EC2 permissions\" \/><\/p>\n<ul>\n<li>Tag is optional we can skip it, review the permissions, and create the user finally. Download the CSV as this is the last time it is available for download, this file contains the access key ID and the secret key which will be used next in code.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723025453\/Screenshotfrom20200511212548.png\" alt=\"AWS permission review page\" \/><\/p>\n<p>Now we are all set to launch our EC2 instance using python code. For making a connection with EC2 instance we use boto3\u2019s client API. The client API takes in following arguments to make a connection with AWS the service.<\/p>\n<ul>\n<li><strong>Service Name:<\/strong>\u00a0The service to which connection has to be established.<\/li>\n<li><strong>Region:\u00a0<\/strong>Amazon EC2 is hosted in multiple locations worldwide. Based on our need we can choose our region, we have taken Asia-pacific as our region( \u2018ap-south-1\u2019 ).<\/li>\n<li><strong>aws_access_key_id:\u00a0<\/strong>AWS Security Credentials. Paste the downloaded ID in the blank space.<\/li>\n<li><strong>aws_secret_access_key:\u00a0<\/strong>AWS Security Credentials. Paste the downloaded secret key in the blank space.<\/li>\n<\/ul>\n<h4><strong>Implementation:<\/strong><\/h4>\n<div class=\"noIdeBtnDiv\">\n<div class=\"responsive-tabs-wrapper\">\n<div class=\"responsive-tabs responsive-tabs--enabled\">\n<ul class=\"responsive-tabs__list\" role=\"tablist\">\n<li id=\"tablist1-tab1\" class=\"responsive-tabs__list__item responsive-tabs__list__item--active\" tabindex=\"0\" role=\"tab\" aria-controls=\"tablist1-panel1\">Python3<\/li>\n<\/ul>\n<div id=\"tablist1-panel1\" class=\"tabcontent responsive-tabs__panel responsive-tabs__panel--active\" role=\"tabpanel\" aria-hidden=\"false\" aria-labelledby=\"tablist1-tab1\">\n<div class=\"code-block\">\n<div class=\"code-container\">\n<div id=\"highlighter_273616\" class=\"syntaxhighlighter nogutter\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"comments\">#Python Program for creating a connection<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"keyword\">import<\/code> <code class=\"plain\">boto3<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain\">ec2 <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">boto3.client(<\/code><code class=\"string\">'ec2'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"string\">'ap-south-1'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_access_key_id<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'',<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_secret_access_key<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'')<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"comments\">#This function will describe all the instances<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"comments\">#with their current state<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"plain\">response <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">ec2.describe_instances()<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"functions\">print<\/code><code class=\"plain\">(response)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>OUTPUT<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723045105\/3.png\" alt=\"EC2 instance launch through cmd\" \/><\/p>\n<h3><strong>Creating an instance<\/strong>:<\/h3>\n<p>The\u00a0<i><strong>ec2.run_instances<\/strong><\/i>\u00a0launches the specified number of instances using an AMI for which you have permissions. It provides a variety of launch configurations, but we can launch instances with few of the following arguments.<\/p>\n<ul>\n<li><strong>InstanceType:<\/strong>\u00a0The instance type that you specify determines the hardware of the host computer used for your instance. Each instance type offers different compute, memory, and storage capabilities and are grouped in instance families based on these capabilities. However, AWS provides \u201ct2.micro\u201d as free in the Free Tier limit.<\/li>\n<li><strong>MaxCount:\u00a0<\/strong>The maximum number of instances to launch. If MaxCount &gt; available instances in target Availability Zone, then it launches the maximum number of Instances greater than MinCount.<\/li>\n<li><strong>MinCount:\u00a0<\/strong>The minimum number of instances to launch. \u00a0If available instances in target Availability Zone &lt; MinCount, then no instances are launched.<\/li>\n<li><strong>ImageId:\u00a0<\/strong>The ID of the AMI used to launch the instance. For our case we have chosen Ubuntu Server 18.04 LTS (HVM), SSD Volume Type (ami-02d55cb47e83a99a0).<\/li>\n<\/ul>\n<h4><strong>Implementation:<\/strong><\/h4>\n<div class=\"noIdeBtnDiv\">\n<div class=\"responsive-tabs-wrapper\">\n<div class=\"responsive-tabs responsive-tabs--enabled\">\n<ul class=\"responsive-tabs__list\" role=\"tablist\">\n<li id=\"tablist2-tab1\" class=\"responsive-tabs__list__item responsive-tabs__list__item--active\" tabindex=\"0\" role=\"tab\" aria-controls=\"tablist2-panel1\">Python3<\/li>\n<\/ul>\n<div id=\"tablist2-panel1\" class=\"tabcontent responsive-tabs__panel responsive-tabs__panel--active\" role=\"tabpanel\" aria-hidden=\"false\" aria-labelledby=\"tablist2-tab1\">\n<div class=\"code-block\">\n<div class=\"code-container\">\n<div id=\"highlighter_832729\" class=\"syntaxhighlighter nogutter\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"comments\">#Python Program for creating a connection<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"keyword\">import<\/code> <code class=\"plain\">boto3<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"comments\">#Function for connecting to EC2<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"plain\">ec2 <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">boto3.client(<\/code><code class=\"string\">'ec2'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"string\">'ap-south-1'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_access_key_id<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'',<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_secret_access_key<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'')<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"comments\">#Function for running instances<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"plain\">conn <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">ec2.run_instances(InstanceType<\/code><code class=\"keyword\">=<\/code><code class=\"string\">\"t2.micro\"<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">MaxCount<\/code><code class=\"keyword\">=<\/code><code class=\"value\">1<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">MinCount<\/code><code class=\"keyword\">=<\/code><code class=\"value\">1<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">ImageId<\/code><code class=\"keyword\">=<\/code><code class=\"string\">\"ami-02d55cb47e83a99a0\"<\/code><code class=\"plain\">)<\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"functions\">print<\/code><code class=\"plain\">(conn)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>OUTPUT<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/uploads\/20200723034224\/Screenshotfrom20200512131830.png\" alt=\"EC2 instance launch through cmd\" \/><\/p>\n<h4>How to terminate an EC2 instance using Python and the boto3 library:<\/h4>\n<p>To terminate an EC2 instance using Python and the boto3 library, you can use the terminate_instances() method of the ec2 client. This method requires you to provide the InstanceIds of the instances that you want to terminate as a list.<\/p>\n<p>Here is an example of how you can terminate an EC2 instance using Python and boto3:<\/p>\n<div class=\"responsive-tabs-wrapper\">\n<div class=\"responsive-tabs responsive-tabs--enabled\">\n<ul class=\"responsive-tabs__list\" role=\"tablist\">\n<li id=\"tablist3-tab1\" class=\"responsive-tabs__list__item responsive-tabs__list__item--active\" tabindex=\"0\" role=\"tab\" aria-controls=\"tablist3-panel1\">Python3<\/li>\n<\/ul>\n<div id=\"tablist3-panel1\" class=\"tabcontent responsive-tabs__panel responsive-tabs__panel--active\" role=\"tabpanel\" aria-hidden=\"false\" aria-labelledby=\"tablist3-tab1\">\n<div class=\"code-block\">\n<div class=\"code-container\">\n<div id=\"highlighter_113672\" class=\"syntaxhighlighter nogutter\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"keyword\">import<\/code> <code class=\"plain\">boto3<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"comments\"># Connect to the EC2 service<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain\">ec2 <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">boto3.client(<\/code><code class=\"string\">'ec2'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"string\">'ap-south-1'<\/code><code class=\"plain\">,<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_access_key_id<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'',<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"undefined spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"plain\">aws_secret_access_key<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">'')<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"comments\"># Terminate the instance with the specified ID<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"plain\">response <\/code><code class=\"keyword\">=<\/code> <code class=\"plain\">ec2.terminate_instances(InstanceIds<\/code><code class=\"keyword\">=<\/code><code class=\"plain\">[<\/code><code class=\"string\">'instance-id-1'<\/code><code class=\"plain\">])<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"comments\"># Print the response<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"functions\">print<\/code><code class=\"plain\">(response)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Note that the terminate_instances() method returns a TerminateInstancesResponse object, which contains information about the request and the instances that were terminated. You can access the TerminatingInstances field of this object to get a list of InstanceStateChange objects, which contain information about the state of the terminated instances, such as their ID, previous state, and current state.<\/p>\n        <div class=\"booster-block booster-reactions-block\">\n            <div class=\"twp-reactions-icons\">\n                \n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-1\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/happy.svg\" alt=\"Happy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Happy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-2\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sad.svg\" alt=\"Sad\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sad                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-3\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/excited.svg\" alt=\"Excited\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Excited                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-6\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sleepy.svg\" alt=\"Sleepy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sleepy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-4\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/angry.svg\" alt=\"Angry\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Angry<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                        \n                    <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-5\" post-id=\"636\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/surprise.svg\" alt=\"Surprise\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Surprise<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n            <\/div>\n        <\/div>\n\n    <\/div>","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn how python can be<a href=\"https:\/\/www.bees-team.com\/?p=636\">Read More<i class=\"fa fa-long-arrow-right\" aria-hidden=\"true\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":639,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-636","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Launching AWS EC2 Instance using Python - Experiment Log<\/title>\n<meta name=\"description\" content=\"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Launching AWS EC2 Instance using Python - Experiment Log\" \/>\n<meta property=\"og:description\" content=\"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bees-team.com\/?p=636\" \/>\n<meta property=\"og:site_name\" content=\"Experiment Log\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-20T09:11:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1278\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Bees-Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bees-Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636\"},\"author\":{\"name\":\"Bees-Team\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"headline\":\"Launching AWS EC2 Instance using Python\",\"datePublished\":\"2023-06-20T09:11:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636\"},\"wordCount\":632,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/aws_boto3_python.png\",\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=636#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636\",\"name\":\"Launching AWS EC2 Instance using Python - Experiment Log\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/aws_boto3_python.png\",\"datePublished\":\"2023-06-20T09:11:40+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"description\":\"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=636\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#primaryimage\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/aws_boto3_python.png\",\"contentUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/aws_boto3_python.png\",\"width\":1278,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=636#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bees-team.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Launching AWS EC2 Instance using Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\",\"name\":\"Experiment Log\",\"description\":\"Just note what I did\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bees-team.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\",\"name\":\"Bees-Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"caption\":\"Bees-Team\"},\"sameAs\":[\"https:\\\/\\\/www.bees-team.com\\\/\"],\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Launching AWS EC2 Instance using Python - Experiment Log","description":"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Launching AWS EC2 Instance using Python - Experiment Log","og_description":"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).","og_url":"https:\/\/www.bees-team.com\/?p=636","og_site_name":"Experiment Log","article_published_time":"2023-06-20T09:11:40+00:00","og_image":[{"width":1278,"height":720,"url":"http:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png","type":"image\/png"}],"author":"Bees-Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bees-Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bees-team.com\/?p=636#article","isPartOf":{"@id":"https:\/\/www.bees-team.com\/?p=636"},"author":{"name":"Bees-Team","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"headline":"Launching AWS EC2 Instance using Python","datePublished":"2023-06-20T09:11:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=636"},"wordCount":632,"commentCount":0,"image":{"@id":"https:\/\/www.bees-team.com\/?p=636#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png","articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bees-team.com\/?p=636#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bees-team.com\/?p=636","url":"https:\/\/www.bees-team.com\/?p=636","name":"Launching AWS EC2 Instance using Python - Experiment Log","isPartOf":{"@id":"https:\/\/www.bees-team.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=636#primaryimage"},"image":{"@id":"https:\/\/www.bees-team.com\/?p=636#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png","datePublished":"2023-06-20T09:11:40+00:00","author":{"@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"description":"In this article, we will learn how python can be used for creating and managing Amazon Web Services (AWS) such as Elastic Compute Cloud (EC2), Simple Storage Service (S3), Relational Database Service (RDS). For this purpose, we will use boto3 library of python, Boto is a Python package that provides interfaces to Amazon Web Services (AWS).","breadcrumb":{"@id":"https:\/\/www.bees-team.com\/?p=636#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bees-team.com\/?p=636"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bees-team.com\/?p=636#primaryimage","url":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png","contentUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/06\/aws_boto3_python.png","width":1278,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/www.bees-team.com\/?p=636#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bees-team.com\/"},{"@type":"ListItem","position":2,"name":"Launching AWS EC2 Instance using Python"}]},{"@type":"WebSite","@id":"https:\/\/www.bees-team.com\/#website","url":"https:\/\/www.bees-team.com\/","name":"Experiment Log","description":"Just note what I did","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bees-team.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197","name":"Bees-Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","caption":"Bees-Team"},"sameAs":["https:\/\/www.bees-team.com\/"],"url":"https:\/\/www.bees-team.com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=636"}],"version-history":[{"count":4,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions\/641"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/media\/639"}],"wp:attachment":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}