├── Assignment 2.docx ├── IAM ├── LICENSE ├── RDS ├── Route53 ├── S3 ├── SNS for S3 ├── VPC ├── autoscalling ├── db.java ├── ec2 ├── elasticBeanstalk ├── extra ├── loadbalancer ├── node.js ├── python.py ├── session1_overview ├── session2 └── ~$signment 2.docx /Assignment 2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aakashdeveloper/AWS_Service/d508b99faf8c8d749d9dfe16ec717d3859f939e3/Assignment 2.docx -------------------------------------------------------------------------------- /IAM: -------------------------------------------------------------------------------- 1 | component of IAM 2 | > Users => 3 | Each person can be one User 4 | Each user can have different permissions 5 | 6 | > Group 7 | We can club multiple user and provide common acces 8 | 9 | > Roles 10 | Roles are not for users 11 | Roles are for service 12 | Ec2 => S3, RDS 13 | 14 | > Policies 15 | 16 | 17 | Development 18 | 19 | UserA UserB UserC 20 | IAM S3 RDS 21 | S3 RDS S3 22 | RDS 23 | 24 | 25 | Group Developer (S3,RDS) 26 | UserA (IAM) 27 | UserB 28 | UserC 29 | 30 | 31 | Policies 32 | IAM> Create Group, Create user, create Roles 33 | RDS> Read, write 34 | 35 | 36 | MyPolicy 37 | IAM> Create Group 38 | RDS> Read acces 39 | 40 | JSON 41 | { 42 | "name":"a", 43 | "class":"b" 44 | } 45 | 46 | /********************* 47 | Check All Policy 48 | ***********************/ 49 | > AWS Dashboard 50 | > IAM 51 | >Policies 52 | >List All Policy 53 | 54 | /********************* 55 | Create Cutsome Policy 56 | ***********************/ 57 | > Policies 58 | > create Policy 59 | > choose service 60 | > Select the actions 61 | > Review Policy 62 | >Provide policy name 63 | >Create policy 64 | 65 | /******************************* 66 | Create New IAM USer 67 | *********************************/ 68 | > user 69 | >Create user 70 | >Name , Accesstypee 71 | >custome password 72 | >Attach existing Policies 73 | >select policy 74 | >Add Tags 75 | >Review and create 76 | 77 | /******************************* 78 | Login with IAM user 79 | *********************************/ 80 | > Select User 81 | > security credential 82 | >use summery console login url: 83 | 84 | 85 | /******************************* 86 | Asign MFA 87 | *********************************/ 88 | > Select user 89 | >security credential 90 | > Assign MFA 91 | >Virtual MFA 92 | > Show QR 93 | > Scan Qr and enter code 94 | 95 | /************************** 96 | Add uSer to group 97 | **************************/ 98 | =>Select group 99 | =>user 100 | =>Add User 101 | =>Select Listed User 102 | =>Add 103 | 104 | Roles are for the applications 105 | Groups for the user 106 | 107 | /************************** 108 | Create Role 109 | **************************/ 110 | => Role 111 | =>Create Role 112 | `=> Aws Service 113 | => Select service to which yo want to attach policy 114 | => Add Permission to the Service 115 | =>Add tags and Create 116 | 117 | ** We can attach role to service on there own dashboard 118 | 119 | /****************************************** 120 | Access resource from diff account 121 | ******************************************/ 122 | Acc1 (Aakash Handa) Sender 123 | =>IAM 124 | =>Role 125 | =>Another AWS account 126 | =>Account ID(of aakash) 127 | =>Add permission(s3 full access) 128 | =>RoleName 129 | 130 | 131 | 132 | **Root user(reciver) cannot access any other 133 | **Only IAM user(reciver) can accesss any other account resource 134 | 135 | >>>>>>Acc2 (Aakash) Reciver<<<<<<<<<<< 136 | ** Access S3 of aakashhanda account 137 | => Create new IAM user(with no permission no group) 138 | 139 | => Create new dummy Group(no user no policy) 140 | 141 | =>Select create group 142 | =>Permission 143 | =>Add Inline Policies 144 | =>Json 145 | =>Create policy 146 | =>Write JSon 147 | { 148 | "Version":"2012-10-17", 149 | "Statement":{ 150 | "Effect":"Allow", 151 | "Action":"sts:AssumeRole", 152 | "Resource":"arn:aws:iam::276374296137:role/S3extrenalAcess" 153 | (ARN of role created in sender account) 154 | } 155 | } 156 | => Attach user to group 157 | 158 | => Login with IAM user 159 | =>Swtich role 160 | =>Account* (number od aakashhanda(sender) account) 161 | Role* (created in aakash handa account) 162 | =>Switch Role 163 | 164 | 165 | ///////// 166 | User 167 | Group 168 | Role 169 | Policies => Already defined -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /RDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aakashdeveloper/AWS_Service/d508b99faf8c8d749d9dfe16ec717d3859f939e3/RDS -------------------------------------------------------------------------------- /Route53: -------------------------------------------------------------------------------- 1 | www. aakashanda .me 2 | host subdomain top level domain 3 | 4 | A record => help to map domain Name to IP address 5 | A record for IPv4 6 | AAAA fro IPv6 7 | 8 | FQDN 9 | Fully Qualified Domain Name 10 | 11 | 12 | 13 | IAM 14 | VPC 15 | EC2 16 | LoadBalance 17 | AutoScale 18 | S3 19 | Route53 20 | EBS 21 | LightSail 22 | Elastic Bean Stack 23 | 24 | 25 | Ec2 => Route53 26 | S3=> Route53 27 | ELB 28 | 29 | /*********************** 30 | Create Hosted Zone 31 | **********************/ 32 | Route53 33 | Create Hosted Zone 34 | =>Provide 35 | DoaminName Type 36 | aakashhanda.xyz Public 37 | => Add the NS records in your Domain Server 38 | (bigrock, godaddy) 39 | 40 | 41 | /*********************** 42 | Host A Website(Ec2) 43 | **********************/ 44 | =>Create One public Ec2 with app 45 | =>Add Http in both inbound and outbound rule 46 | =>Create record Set(route53) 47 | =>Provide 48 | Name Type Value Routig Policy 49 | Keep it blank Arecrod Public IP Simple 50 | 51 | /*********************** 52 | Host A Website(S3 Bucket) 53 | **********************/ 54 | =>Create One S3 Bucket 55 | =>Create Static Website Hosting in S3 Bucket 56 | =>Create record Set(route53) 57 | =>Alias(yes) 58 | =>From S3 drop down 59 | =>Select S3 instance 60 | =>Routing Policy(simple) 61 | =>Create 62 | 63 | /*********************** 64 | For Weight Routing 65 | **********************/ 66 | =>Create Record Set 67 | =>Add IP 68 | =>Type(weight) 69 | =>Provide 70 | Weight SetID 71 | 2 First 72 | 73 | **We have to provide weight between 0 -255 74 | 0 Is not active machine 75 | 76 | ** % weight is decided by weight of machine/Total weigh 77 | 8+7+11=26 78 | 8/26 = 30% 79 | 7/26 = 27% 80 | 11/26 = 42% 81 | ========99% 82 | 83 | 4+8+7+11=30 84 | 85 | 86 | 4/30 = 13% 87 | 8/30 =26% 88 | 7/30 = 23% 89 | 11/30 = 36% 90 | 91 | 92 | /*********************** 93 | For Failover Routing 94 | **********************/ 95 | => Create Health Check 96 | =>Provide 97 | Name ServerIP HealthCheckUrl 98 | TestApp 10.0.01.1 inex.html 99 | =>Create Record Set 100 | =>Add IP 101 | =>Type FailOver Routing 102 | =>Set Primary or Secondary -------------------------------------------------------------------------------- /S3: -------------------------------------------------------------------------------- 1 | 99.99999999 11nine 2 | 3 | Database vs ObjectStorage 4 | Structred Open & Unstructed 5 | Mysql 6 | Oracle 7 | Mongo 8 | 9 | 10000file in 1000year 1file loose 10 | 11 | => Object Based Storage 12 | => 100 bucket per account 13 | => Object Size <= 5TB 14 | => Global Service 15 | => upto 5GB => Free 16 | 17 | /********************* 18 | Create bucket 19 | *********************/ 20 | =>S3 21 | => Create bucket 22 | => provide Unique name(select region) 23 | =>Create bucket 24 | 25 | /********************* 26 | Upload in bucket 27 | *********************/ 28 | => Select the bucket 29 | =>Add File 30 | => upload 31 | 32 | /********************* 33 | Make Bucket Public 34 | *********************/ 35 | => Select bucket 36 | =>Permission 37 | =>Edit 38 | =>Uncheck public option 39 | 40 | /********************** 41 | Versioning 42 | *********************/ 43 | Unversioned | enabled | suspend 44 | version is Will maintain If already some object have version they we will 45 | disabled versions remain unaffected but new will not get Versioning 46 | 47 | /********************** 48 | Host Wesbite with S3 49 | *********************/ 50 | => Create a Bucket 51 | => create static html page 52 | =>upload html page 53 | => Properties 54 | =>Static website hosting 55 | => Provide main File 56 | =>Hit Url 57 | /********************** 58 | Object-level logging 59 | *********************/ 60 | Enable logging for each object with cloudtrail 61 | 62 | /********************** 63 | Default encryption 64 | *********************/ 65 | We can encrypt data in multiple format for security 66 | 67 | /********************** 68 | Object lock 69 | *********************/ 70 | Can be done only during the creation (WORM) 71 | Write one read many 72 | 73 | /********************** 74 | Tags 75 | *********************/ 76 | Can provide name to bucket by Tags 77 | 78 | /********************** 79 | Transfer acceleration 80 | *********************/ 81 | With enabling this I/O will be much faster 82 | but cost incresse 83 | 84 | /********************** 85 | Events 86 | *********************/ 87 | We can trigger event on the operation selected 88 | It can any crud operation 89 | 90 | We can fire Lambda, SNS and SQS 91 | 92 | /********************** 93 | Requester pays 94 | *********************/ 95 | 96 | It make requester charged for the file access 97 | insted for admin 98 | 99 | /********************** 100 | Storage Classes 101 | *********************/ 102 | S3 standard =>> Immediate access / frequent access /important data 103 | S3 IA =>Imp data but less frequent access 104 | S3 RR => not critiacl data 105 | Amazon Glacier => Long time backups not critiacl data 106 | 107 | /********************** 108 | CRR(cross region replication) 109 | *********************/ 110 | SourceBucket => Versioning enabled => diff region 111 | targetBucket => Versioning enabled => diff region 112 | 113 | => Select source bucket 114 | =>mangement 115 | =>replication 116 | =>Select source Bucket 117 | enable encryotion 118 | => Select target bucket 119 | =>Save 120 | -------------------------------------------------------------------------------- /SNS for S3: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2008-10-17", 3 | "Id": "example-ID", 4 | "Statement": [ 5 | { 6 | "Sid": "example-statement-ID", 7 | "Effect": "Allow", 8 | "Principal": { 9 | "Service": "s3.amazonaws.com" 10 | }, 11 | "Action": "SNS:Publish", 12 | "Resource": "arn:aws:sns:ap-southeast-1:276374296137:snsfors3", 13 | "Condition": { 14 | "ArnLike": { 15 | "aws:SourceArn": "arn:aws:s3:*:*:aakashhanda.xyyz" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /VPC: -------------------------------------------------------------------------------- 1 | Understand VPC 2 | Design Arch. of VPC 3 | And Implement VPC 4 | ************************* 5 | 40% exam question from VPC 6 | Public IP = accesicable Outside and Auto generated 7 | Private IP => accesicablein VPC and auto generated 8 | Elastic Public Static IP=> If IP is attached to Instance 9 | its free, If you keepn it idel 10 | its chargeable 11 | 12 | CIDR 13 | >Classless inter-domain routing 14 | IPv4 15 | -32Bit 16 | x.x.x.x/16 - x.x.x.x/28 17 | 10.0.0.0/16 = 32-16 = 16 => 2^16 = 65536 ipaddress-5 (65531) 18 | 10.0.0.0/24 = 32-24 = 8 => 2^8 = 256 19 | 10.0.0.0/28 = 32-28 = 4 => 2^4 = 16 20 | 21 | IPv6 22 | -128Bit 23 | 24 | 25 | VPC1 | VPC2 26 | 192.65.32.1 | 192.65.32.2 27 | 10.0.0.1/20 | 10.0.0.1/20 28 | 10.0.0.2/21 | 10.0.0.2/21 29 | 30 | /************************** 31 | Step To create VPC 32 | ****************************/ 33 | =>On AWS console 34 | => Networking 35 | =>VPC 36 | => Your VPC 37 | =>Create VPC 38 | => Provide VPC 39 | Name Cidr 40 | demovpc 10.0.0.0/16 41 | =>Create 42 | 43 | *** It will create one default Route table 44 | 45 | /************************** 46 | launch Subnet 47 | ****************************/ 48 | => Subnet 49 | =>Create Subnet 50 | =>Enter details 51 | Name VPC Availability Zone IPv4 CIDR block 52 | Public Demovpc Select az 10.0.1.0/24 53 | Private Demovpc Select az 10.0.2.0/24 54 | 55 | *** IPv4 CIDR block => Should be unique 56 | *** All Subets default enter in default Route Table 57 | 58 | /************************** 59 | Create Route table 60 | ****************************/ 61 | => Route Table 62 | =>Create RouteTable 63 | => Provid 64 | Name VPC 65 | PublicRT Demovpc 66 | PrivateRt DemoVpc 67 | 68 | /************************** 69 | Create Internet Gateway 70 | ****************************/ 71 | => Internet Gateway 72 | => Create Internet Gateway 73 | => Provide 74 | Name 75 | demovpcIg 76 | 77 | ** Default it's deteched 78 | 79 | /************************** 80 | Set to attch Internet Gateway 81 | ****************************/ 82 | => Select your IG 83 | =>Action 84 | =>Attach IG 85 | => Select VPC 86 | 87 | /************************** 88 | Add Subnet to route Table 89 | ****************************/ 90 | => Select Route table 91 | =>Action 92 | => Edit Subnet Association 93 | => Select Subnet 94 | =>Save 95 | 96 | /************************** 97 | Step to associate Ig 98 | ****************************/ 99 | => Select PublicRT 100 | => Action 101 | =>EditRoutes 102 | =>Provide 103 | Destination Target 104 | 0.0.0.0/0 Select Internet Gateway 105 | => Select your IG 106 | 107 | /********************************** 108 | Launch Instance in Public Subnet 109 | ************************************/ 110 | => Go To EC2 111 | =>Launch Instance 112 | =>Select Amazon Linux AMI 2018.03.0 113 | =>Next 114 | =>Provide 115 | Network Subnet Auto-assign Public IP 116 | DemoVpc Public Enable 117 | =>Next 118 | =>Storage(default) 119 | =>Tag 120 | Name PublicLinux 121 | =>Launch 122 | 123 | *** In Private Sunet 'Auto-assign Public IP' Should be disable 124 | 125 | PuttyGen 126 | => .pem =>.ppk 127 | 128 | /********************************** 129 | Step to connect with Instance 130 | ************************************/ 131 | =>Select EC2 132 | => connect 133 | =>Window => connect to PuttyGen 134 | =>mac/linux => ssh 135 | =>enter command in terminal with right .pem file access 136 | 137 | *** make .pem file readable 138 | => chmod 400 139 | 140 | /********************************** 141 | Step to connect Public with Private 142 | ************************************/ 143 | 144 | *** We need .pem file of Private 145 | We will copy .pem file and create 146 | one new file in public instance to access private instance 147 | /############### 148 | Step to create .pem in Public instance 149 | ###############/ 150 | => Connect with public instance 151 | =>sudo su - 152 | =>vi demoprivate.pem 153 | =>press esc 154 | =>:wq! 155 | => Provide Permisson 156 | =>ssh -i 'demoprivate.pem' ec2-user@10.0.2.67 157 | https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html?icmpid=docs_ec2_console 158 | 159 | 160 | /************************** 161 | Step To create NAT Gateway 162 | ****************************/ 163 | => Generate Elastic IP 164 | => Elastic IP 165 | =>amazon pool 166 | => Allocate 167 | *** Its Paid if its not attached 168 | 169 | =>Select NAT Gateway 170 | =>Provide 171 | Subnet ElasticIP 172 | Public subnet Generated EIP 173 | 174 | /************************** 175 | Attach to Route Table 176 | ****************************/ 177 | => Go to RouteTable 178 | =>Private Route table 179 | =>Actions 180 | =>Edit Routes 181 | =>Provide 182 | Destination Target 183 | 0.0.0.0/0 Nat 184 | 185 | /************************** 186 | Testing of Nat 187 | ****************************/ 188 | => Connect private machine from public subnet 189 | =>Try ping google.com 190 | 191 | 192 | /************************** 193 | Step To create NAT Instance 194 | ****************************/ 195 | => EC2 196 | =>Instance 197 | =>Launch Instance 198 | =>Select Community AMI 199 | =>Search NAT 200 | =>Select First Nat 201 | =>Configuration 202 | Provide 203 | Demovpc public subnet 204 | =>launch 205 | 206 | /************************** 207 | Step To Associate EIP with NAT 208 | ****************************/ 209 | => Select Elastic IP 210 | =>Generate New EIP 211 | =>Select EIP 212 | =>Action 213 | =>Associate Address 214 | =>Select Instance 215 | =>NAt Instance 216 | 217 | =>Route Table 218 | =>Priavte RouteTable 219 | =>Select Route 220 | =>Edit Route 221 | =>Provide 222 | 0.0.0.0/0 Instance(NAT) 223 | 224 | =>Go To EC2 225 | =>Select NAT instance 226 | =>securityGroup 227 | =>launch-wizard 228 | =>Inbound 229 | =>Edit 230 | =>Add Rule 231 | =>Provide 232 | Type CIDR 233 | ALL ICMP 10.0.2.0/24 234 | 235 | /************************** 236 | SG & ACL 237 | ****************************/ 238 | SG 239 | >Virtual Firewall accross the instance 240 | >statefull in nature 241 | >only allow Rule 242 | >deny all mode 243 | 244 | NACl 245 | Virtual firewall accross the subnet 246 | >stateless 247 | >allow & denay also 248 | >everything is allowed 249 | 250 | 251 | /************************** 252 | Step For SG 253 | ****************************/ 254 | =>securityGroup in EC2 consle 255 | =>Create securityGroup 256 | =>Provide 257 | Name description VPC 258 | mysg aboutmysg Dmeo 259 | 260 | 261 | /************************** 262 | Step For ACL 263 | ****************************/ 264 | => Newtwork ACL(vpc) 265 | =>Provide Name 266 | =>Select VPC 267 | =>Add Rule 268 | *** Prioerity is on the basis of Rule number 269 | lower the rule number higher the priority -------------------------------------------------------------------------------- /autoscalling: -------------------------------------------------------------------------------- 1 | /************************** 2 | Auto scale 3 | **************************/ 4 | Scale in and scale out 5 | 6 | => Launch Configure = Instance Type, AMI, SG, Storage 7 | => Scaling Policy = Scale In and scale out 8 | 9 | connect ec2=> 10 | bash 11 | => stress 12 | => remove stress 13 | 14 | prequest 15 | ==> You must have one AMI 16 | =>Step 17 | => create auto scale group 18 | => Select AMI 19 | =>Configuration Detail 20 | name 21 | myautoscale 22 | =>Advanced Details 23 | =>User data 24 | Add bootstrap 25 | "#!/bin/bash 26 | sudo yum install stress -y 27 | " 28 | =>Create Launch Configuration 29 | Add http 30 | =>Create Auto Scaling Group 31 | =>Groupname 32 | =>Number of instance =1 33 | => Select alteast 3 subnet 34 | =>check Load Balancing 35 | =>Add loadBlacancer 36 | =>Use scaling policies to adjust the capacity of this group 37 | =>Scale the Auto Scaling group using step or simple scaling policies 38 | =>Add Alarm (for both scaleup and scale down) 39 | =>whenever=>CPu 40 | =>is lessthan or greater = provide % 41 | =>Add Tags 42 | 43 | /************************** 44 | Strees Testing ******HW 45 | **************************/ 46 | => Connect with launched Ec2 47 | =>Open terminal 48 | =>type "stress" 49 | =>type "remove stress" 50 | 51 | launch AS group every machine must have stree package 52 | after it add undeer load balancer 53 | => Connect with launched Ec2 54 | =>Open terminal 55 | =>type "stress" 56 | check new machine got added or not 57 | =>type "remove stress" 58 | check machine got removed or not 59 | 60 | 61 | -------------------------------------------------------------------------------- /db.java: -------------------------------------------------------------------------------- 1 | import java.sql.Connection; 2 | import java.sql.DriverManager; 3 | import java.sql.Statement; 4 | import java.sql.ResultSet; 5 | import java.sql.PreparedStatement; 6 | 7 | 8 | public class ProductComponent { 9 | 10 | public void printProductList(double lowPrice, double highPrice) throws Exception { 11 | 12 | try (Connection connection = 13 | DriverManager.getConnection("jdbc:mysql://database-1.c83fdlzp5lmg.us-east-2.rds.amazonaws.com:3306/classicmodels?" 14 | + "user=admin&password=admin987&serverTimezone=UTC"); 15 | 16 | PreparedStatement preparedStatement = connection 17 | .prepareStatement("SELECT * FROM products " 18 | + "WHERE buyPrice BETWEEN ? AND ?");) { 19 | 20 | preparedStatement.setDouble(1, lowPrice); 21 | preparedStatement.setDouble(2, highPrice); 22 | 23 | 24 | 25 | try (ResultSet resultSet = preparedStatement.executeQuery();) { 26 | 27 | while (resultSet.next()) { 28 | 29 | String name = resultSet.getString("productName"); 30 | System.out.println(name); 31 | } 32 | 33 | } 34 | } 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /ec2: -------------------------------------------------------------------------------- 1 | IAAS 2 | core/ foundational service 3 | 70% app running on ec2 4 | VM 5 | Regional Service 6 | Had to launched in VPC 7 | => Free tire limit t2.micro 750hrs 8 | => Configuration 9 | => Instance are =CPU, Storage, Memory, Network 10 | => AMI => OS, Custome AMI 11 | 12 | => Virtualization type: hvm | Para 13 | Hardware vitural machine | Para 14 | Fast Slow 15 | New 16 | support more hardwar Old 17 | 18 | => Root Device 19 | EBS volume, ISVolume 20 | 21 | EBS volume 22 | => Similar to hard disk 23 | => Presistent in nature 24 | => Upto 30GB is Free 25 | => EBS HDD & SDD(solid state disk) 26 | => AMI backuped by EBS volume 27 | => Stop, Run, Terminate & reboot 28 | 29 | Instance Store volume (epnemeral volume) 30 | => Similar to RAM 31 | => Volatile in nature 32 | => Running, Terminate 33 | 34 | Amazone => EBS+ HVM 35 | 36 | ENA=> Network connectors 37 | 38 | Hypervisior mange the resources 39 | 40 | 41 | /************************ 42 | Purchasing option 43 | *************************/ 44 | On Demand Instance => Pay as yo go(/hr) 45 | Reserved Instance => For long term (upto 75% for total) 46 | > 1 yr to 3 yrs 47 | > All upfront, Partial upfront, No upfront 48 | 49 | Spot Instance => Binding or auction 50 | => 2 min and terminate my instance 51 | => 90% cost benift 52 | => Interruption can happen on biding price 53 | => Testing , learning or 54 | => Duration(1hr to 6 hr) 55 | 56 | /************************ 57 | Tenancy 58 | *************************/ 59 | 60 | Shared => Multiple VM on same physical device 61 | Dedicate instance => Instance storage is Presistent and remain as backup 62 | Dedicate Host => Dedicated physical Machine for my VM 63 | 64 | 65 | 66 | /************************ 67 | Use linux as web server 68 | *************************/ 69 | => sudo su - 70 | => yum install httpd -y 71 | => cd /var/www/html 72 | => vi index.html 73 | =>

Hi welcome

74 | => press Ecs 75 | => :wq! 76 | => chmod 755 index.html 77 | => service httpd start 78 | => chkconfig httpd on 79 | => publicip/ index.html 80 | 81 |
82 |

Linux Machine

83 |
84 | 85 | //node > 86 | https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html 87 | 88 | /************************ 89 | Use Windows as web server 90 | *************************/ 91 | => Install IIS 92 | => Install-WindowsFeature -name Web-Server -IncludeManagementTools 93 | => C:/inetpub/wwwroot/index.html 94 | =>

Hi welcome

95 | => publicip/ index.html 96 | 97 | /************************ 98 | Golden Image(Custome Image) AMI 99 | *************************/ 100 | => Select Instance 101 | =>Action 102 | =>Image 103 | =>Create Image 104 | => Name & No Reboot 105 | 106 | EC2 => Images => AMI (images list here) 107 | 108 | Copy to other Region 109 | => Select Image 110 | =>Action 111 | => Modify Image Perission 112 | | 113 | ------------------------ 114 | | | 115 | Public Add Aws User Account Number 116 | 117 | /********************** 118 | Create volume 119 | **************************/ 120 | Linux 121 | => xvda 122 | xen, virtual, disk , a is for first volume 123 | 124 | => Elastic Block Storage 125 | => Create Volume 126 | => AZ(create in same AZ as EC2) 127 | => Create Volume 128 | 129 | /********************** 130 | Attach volume 131 | **************************/ 132 | => Select Volume 133 | => Actions 134 | => Attach volume 135 | => Select Instance 136 | =>Done 137 | 138 | /********************** 139 | Snapshot Of EBS 140 | **************************/ 141 | => Select Volume 142 | => Action 143 | => create Snapshot 144 | => tag 145 | => Create 146 | 147 | AMI in EBS 148 | Volume in S3 149 | 150 | /********************** 151 | Vertiacl Scale 152 | **************************/ 153 | => Select Instance 154 | => Stop Instance 155 | => Action 156 | => Instance Setting 157 | => Change instance Type 158 | => Select Type 159 | =>Apply 160 | 161 | 162 | /********************** 163 | Placement Group 164 | *******************/ 165 | Cluster is in single AZ on same physical server 166 | Spreed in single AZ but different physical Server 167 | => Placement Group 168 | => Create Placement Group 169 | => Name and Stargey 170 | 171 | => Logical grouping of instance 172 | => To improve through put and reduce latency 173 | => 10 Gib 174 | => Heavy I/O should in once placement group 175 | 176 | /********************** 177 | Change Key Pair 178 | *******************/ 179 | => Select Key pair tab 180 | => Create new key Pair 181 | 182 | =>Select instance 183 | => Action 184 | => Instance Setting 185 | => View & change user data 186 | 187 | 188 | /************************ 189 | Elastic PUBLIC IP 190 | *************************/ 191 | > Elastic IPs 192 | > Allocate Elastic IP 193 | >Allocate 194 | 195 | Security Group 196 | 197 | 198 | // 199 | Auto Scaling 200 | Load Balancing 201 | S3 202 | DataBase 203 | 204 | 205 | //VPC 206 | //Route53 207 | //Cloud Watch 208 | //Cloud Trail 209 | 210 | SNS 211 | SQS 212 | SES 213 | OpsWork 214 | Well Arch 215 | 216 | -------- 217 | Lamdba 218 | CodePipeLine 219 | Ecs 220 | 221 | 222 | Public 223 | 13.229.129.153 224 | 3.0.19.185 225 | 226 | Private 227 | 172.31.25.163 -------------------------------------------------------------------------------- /elasticBeanstalk: -------------------------------------------------------------------------------- 1 | PAAS 2 | PlatForm as a Service 3 | 4 | 5 | RollNo English Hindi comp 6 | 1 80 7 | 2 80 80 8 | 3 80 9 | 10 | [ 11 | { 12 | rollno:1, 13 | English:80 14 | }, 15 | { 16 | rollno:2, 17 | Hindi:80 18 | }, 19 | { 20 | rollno:3, 21 | Comp:80 22 | } 23 | ] 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /extra: -------------------------------------------------------------------------------- 1 | Access resource from diff account 2 | Ec2 3 | 4 | 5 | { 6 | "name":"sss", 7 | "class":"ddd" 8 | } 9 | 10 | 11 | RDS 12 | s3 13 | route53 14 | 15 | vpc 16 | -------------------------------------------------------------------------------- /loadbalancer: -------------------------------------------------------------------------------- 1 | => Round robin method 2 | 3 | 123456*8910 4 | 5 | 6 | 7 | 8 | 9 |

Linux Machine

10 | 11 | 12 | 13 | 14 | 15 | 16 |

Window Machine

17 | 18 | 19 | 20 | => Must have min 2 Ec2 instance 21 | => Make index.html up & running 22 | => Ec2 console 23 | => Load balancer 24 | => Create load balancer 25 | => Select classic load balancer 26 | => Provide LB name and select VPC 27 | => Enable advanced VPC configuration === Checked 28 | => Please select at least two Subnets in different Availability 29 | Zones to provide higher availability for your load balancer. 30 | => Select your subnet 31 | Loadbalancerport Load Balancer Port Instance Protocol Instance Port 32 | Http 80 Http 80 33 | 34 | => Configure health Check 35 | 36 | Ping Protocol == Http 37 | Ping Port === 80 38 | Ping Path == index.html 39 | 40 | Response Timeout === 5 seconds 41 | Interval ====30 seconds 42 | Unhealthy threshold == 2 43 | Healthy threshold ==10 44 | => Add Ec2 instance 45 | => Add Tag 46 | =>Review & launch 47 | > add inbound rule as http 80 48 | 49 | /************************** 50 | Auto scale 51 | **************************/ 52 | Scale in and scale out 53 | 54 | => Launch Configure = Instance Type, AMI, SG, Storage 55 | => Scaling Policy = Scale In and scale out 56 | 57 | connect ec2=> 58 | bash 59 | => stress 60 | => remove stress 61 | 62 | prequest 63 | ==> You must have one AMI 64 | =>Step 65 | => create auto scale group 66 | => Select AMI 67 | =>Configuration Detail 68 | name 69 | myautoscale 70 | =>Advanced Details 71 | =>User data 72 | Add bootstrap 73 | "#!/bin/bash 74 | sudo yum install stress -y 75 | " 76 | =>Create Launch Configuration 77 | Add http 78 | =>Create Auto Scaling Group 79 | =>Groupname 80 | =>Number of instance =1 81 | => Select alteast 3 subnet 82 | =>check Load Balancing 83 | =>Add loadBlacancer 84 | =>Use scaling policies to adjust the capacity of this group 85 | =>Scale the Auto Scaling group using step or simple scaling policies 86 | =>Add Alarm (for both scaleup and scale down) 87 | =>whenever=>CPu 88 | =>is lessthan or greater = provide % 89 | =>Add Tags 90 | 91 | /************************** 92 | Strees Testing ******HW 93 | **************************/ 94 | => Connect with launched Ec2 95 | =>Open terminal 96 | =>type "stress" 97 | =>type "remove stress" 98 | -------------------------------------------------------------------------------- /node.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const port = 8900; 4 | const Pool = require('pg').Pool; 5 | const bodyParser = require('body-parser'); 6 | 7 | const pool = new Pool({ 8 | user:'postgres', 9 | host:'localhost', 10 | database:'postgres', 11 | password:'docker', 12 | port:5432 13 | }); 14 | 15 | app.use(bodyParser.urlencoded({extended:false})); 16 | app.use(bodyParser.json()) 17 | 18 | 19 | app.get('/user', (req,res) => { 20 | pool.query('SELECT * FROM employee', (err,result) => { 21 | if(err){ 22 | throw err 23 | }else{ 24 | res.status(200).send(result.rows) 25 | } 26 | }) 27 | }) 28 | 29 | app.post('/addUser', (req,res) => { 30 | const {city,name,phone} = req.body; 31 | pool.query('INSERT INTO employee (city,name,phone) VALUES ($1,$2,$3)' [city,name,phone],(err,result) => { 32 | if(err){ 33 | throw err; 34 | }else{ 35 | res.status(200).send('data inserted') 36 | } 37 | 38 | }) 39 | }) 40 | 41 | app.listen(port, () => { 42 | console.log(`Server is running on port ${port}`) 43 | }) -------------------------------------------------------------------------------- /python.py: -------------------------------------------------------------------------------- 1 | import flask 2 | from flask import request, jsonify 3 | from flask_cors import CORS, cross_origin 4 | from sqlalchemy.orm.util import identity_key 5 | from flask_sqlalchemy import SQLAlchemy 6 | from psycopg2.pool import SimpleConnectionPool 7 | import time 8 | import random 9 | import psycopg2 10 | import os 11 | import csv 12 | from gevent.pywsgi import WSGIServer 13 | import logging 14 | import pandas as pd 15 | from zipfile import ZipFile 16 | 17 | logger = logging.getLogger(__name__) 18 | #logging.basicConfig(level=Parameters.logging) 19 | 20 | 21 | application = flask.Flask(__name__) 22 | application.config["DEBUG"] = True 23 | CORS(application,resources={r"/*": {"origins": "*"}}) 24 | application.config['CORS_HEADERS'] = 'Content-Type' 25 | 26 | 27 | class Apiservice(): 28 | 29 | def __init__(self): 30 | 31 | print('Inside __init__') 32 | self.conn = psycopg2.connect(user='postgres',password='admin12345',host="database-1.cjcjgqizui8x.us-east-1.rds.amazonaws.com",port=5432,dbname='postgres') 33 | 34 | 35 | def getConnection (self): 36 | print('Inside getConnection') 37 | try: 38 | cur = self.conn.cursor() 39 | cur.execute('SELECT 1') 40 | cur.close() 41 | 42 | except Exception as exc: 43 | logger.error(exc) 44 | self.conn = psycopg2.connect(user='postgres',password='admin12345',host="database-1.cjcjgqizui8x.us-east-1.rds.amazonaws.com",port=5432,dbname='postgres') 45 | 46 | return self.conn 47 | 48 | 49 | def getData(self,query): 50 | sql_query = query 51 | conn = apiService.getConnection () 52 | cur = conn.cursor() 53 | out = cur.execute(sql_query) 54 | context_records = cur.fetchall() 55 | out = jsonify(context_records) 56 | return context_records 57 | 58 | def postData(self,query,value): 59 | sql_query = query 60 | conn = apiService.getConnection () 61 | cur = conn.cursor() 62 | cur.execute(sql_query,value) 63 | conn.commit() 64 | return "Data Added" 65 | 66 | @application.route('/health', methods=['GET']) 67 | @cross_origin('*') 68 | def hello(): 69 | return "hello from API" 70 | 71 | @application.route('/userInfo/', methods=['GET']) 72 | @cross_origin('*') 73 | def getEntity(): 74 | output = apiService.getData("SELECT * FROM userinfo") 75 | print(output) 76 | outArray=[] 77 | try: 78 | length = len(output) 79 | for i in range(length): 80 | userinfo={} 81 | userinfo["uname"]= output[i][0] 82 | userinfo["empid"]= output[i][1] 83 | userinfo["tech"]= output[i][2] 84 | outArray.append(userinfo) 85 | except Exception as exc: 86 | print(exc) 87 | return jsonify(outArray) 88 | 89 | 90 | 91 | @application.route('/postuser/', methods=['POST']) 92 | @cross_origin('*') 93 | def postIntent(): 94 | body = request.json 95 | uname= body['uname'] 96 | empid= body['empid'] 97 | tech= body['tech'] 98 | sql_ins="""INSERT INTO userinfo(uname,empid,tech) VALUES (%s,%s,%s)""" 99 | values=(uname,empid,tech) 100 | out = apiService.postData(sql_ins,values) 101 | return out 102 | 103 | 104 | 105 | 106 | 107 | 108 | @application.route('/updateuser/', methods=['PUT']) 109 | @cross_origin('*') 110 | def updateIntent(): 111 | body = request.json 112 | uname= body['uname'] 113 | empid= body['empid'] 114 | tech= body['tech'] 115 | sql_upt="""Update userinfo set uname = %s, tech=%s where empid = %s""" 116 | values=(uname,tech,empid) 117 | out = apiService.postData(sql_upt,values) 118 | return out 119 | 120 | 121 | apiService = Apiservice () 122 | 123 | 124 | if __name__ == '__main__': 125 | #http_server = WSGIServer(('0.0.0.0', 8443), application, keyfile='/opt/epaas/certs/dkey', certfile='/opt/epaas/certs/ca-chain') 126 | http_server = WSGIServer(('0.0.0.0', 8005), application) 127 | http_server.start() 128 | try: 129 | logger.info("LDAP Service is up and running") 130 | http_server.serve_forever() 131 | 132 | except Exception as exc: 133 | logger.exception(exc) -------------------------------------------------------------------------------- /session1_overview: -------------------------------------------------------------------------------- 1 | OnPrim 2 | 3 | cloud 4 | hybrid> oprim+cloud 5 | multiCloud> aws+gcp+azure 6 | 7 | 8 | IAAS => Infrastructure as a service (Ec2) 9 | PAAS => Platform as a service (Bring your code)(Elastic BeanStalk) 10 | SAAS => Software as Service(Free RTOS,WorkMail) 11 | 12 | -------------------------------------------------------------------------------- /session2: -------------------------------------------------------------------------------- 1 | Active - Active 2 | Active - Passive 3 | 4 | RTO => Recovery Time Objective 5 | RPO => Recovery Point Objective 6 | 7 | https://calculator.s3.amazonaws.com/index.html 8 | 9 | https://aws.amazon.com/solutions/case-studies/?customer-references-cards.sort-by=item.additionalFields.publishedDate&customer-references-cards.sort-order=desc 10 | 11 | https://www.youtube.com/channel/UC26NMdgQBbY6wunk_vZwQZQ/videos?view_as=subscriber -------------------------------------------------------------------------------- /~$signment 2.docx: -------------------------------------------------------------------------------- 1 | Aakash Handa Aakash Handaktop/classes/Simpli_Aws_Apr/~$signment 2 --------------------------------------------------------------------------------