SlideShare una empresa de Scribd logo
1 de 34
1
Programming
Amazon Web Services
with Java & Eclipse
- Short Tutorial -
by Markus Klems
markus.klems@kit.edu
2
Amazon Web Service Developer Ecosystem
Java
• AWS Java
libraries
• AWS toolkit
for Eclipse
• …
Ruby
• Ruby gems
(RightScale,
amazon-ec2,
AWS::S3)
• …
PHP
• AWS PHP
libraries
• Zend Web
development
framework
supports S3,
EC2 & SQS
• …
.NET
• AWS SDK for
.NET
(libraries,
Visual Studio
templates)
• Windows on
EC2
• …
FOCUS
… and more.
3
AWS Software Development with Java
AWS Java libraries
Jets3t (James Murty)
Open-source Java toolkit and application suite for Amazon S3 and
CloudFront
http://bitbucket.org/jmurty/jets3t/wiki/Home
Typica (D. Kavanagh, Xerox Corporation)
Open-Source Java libraries for a broad variety of Amazon Web Services
http://code.google.com/p/typica/
Amazon SDK for Java
Open-source Java libraries for a broad variety of Amazon Web Services
http://aws.amazon.com/sdkforjava/
AWS toolkit for Eclipse
Eclipse Plug-in
AWS perspective with views “EC2 Instances”, “EC2 AMIs”, et cetera
AWS Project Wizard
4
AWS Toolkit for Eclipse (1)
Source:www.eclipse.org/downloads/,April2010
5
AWS Toolkit for Eclipse (2)
1) Go to “Help” > “Install New Software…”
2) Enter http://aws.amazon.com/eclipse
Source:aws.amazon.com/eclipse/,April2010
6
AWS Toolkit for Eclipse (3)
Source:aws.amazon.com/eclipse/,April2010
7
AWS Toolkit for Eclipse (4)
Source:aws.amazon.com/eclipse/,April2010
8
Coding
Introduction
9
Amazon Web Service Credentials
10
Programming S3
Introduction
11
Basic S3 Concepts
Buckets
HTTP PUT
HTTP GET
Objects
HTTP PUT
HTTP GET
12
S3 Buckets
DNS-compatible bucket names
Bucket names must be unique in the S3 universe
Bucket names should not contain underscores (_)
Bucket names should be between 3 and 63 characters long
Bucket names should not end with a dash
Bucket names cannot contain two, adjacent periods
Bucket names cannot contain dashes next to periods (e.g., "my-
.bucket.com" and "my.-bucket" are invalid)
13
Operations on Buckets: PUT
PUT: Create a new bucket
PUT / HTTP/1.1
Host: eorg-exercise1.s3.amazonaws.com
Content-Length: 0
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf…
s3.createBucket(“eorg-exercise1");
14
Operations on Buckets: PUT (2)
Set the Bucket Region
PUT / HTTP/1.1
Host: eorg-exercise2.s3.amazonaws.com
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3Y…
Content-Type: text/plain
Content-Length: 124
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>EU</LocationConstraint>
</CreateBucketConfiguration >
CreateBucketRequest request = new
CreateBucketRequest("eorg-exercise2");
request.setRegion("EU");
s3.createBucket(request);
15
Operations on Buckets: PUT (3)
Set Access Control
String bucketName = "eorg-exercise3";
CannedAccessControlList acl =
CannedAccessControlList.PublicRead;
s3.createBucket(bucketName);
s3.setBucketAcl(bucketName, acl);
PUT / HTTP/1.1
Host: eorg-exercise3.s3.amazonaws.com
Content-Length: 0
x-amz-acl: public-read
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep…
16
Operations on Buckets: GET (1)
Return all (up to 1000) of the objects in a bucket
GET / HTTP/1.1
Host: eorg-exercise3.s3.amazonaws.com
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep…
Content-Type: text/plain
String bucketName = "eorg-exercise3";
ObjectListing list = s3.listObjects(new
ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary s : list.getObjectSummaries()) {
System.out.println(" - " + s.getKey() + “ (size = "
+ s.getSize() + ")");
}
17
Operations on S3 Objects: PUT (1)
PUT /isbn-12345 HTTP/1.1
Host: eorg-exercise3.s3.amazonaws.com
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep…
Content-Type: text/plain
Content-Length: 135
Content-MD5: JBVusP8u0QVhBvsvxNDthQ==
[…data…]
String bucketName = "eorg-exercise3";
String key = "isbn-12345";
s3.putObject(new
PutObjectRequest(bucketName, key,
createSampleFile(“Program-AWS")));
18
Operations on S3 Objects: PUT (2)
Object Versioning
BucketVersioningConfiguration config = new
BucketVersioningConfiguration();
config.setStatus(BucketVersioningConfiguration.ENABLED);
SetBucketVersioningConfigurationRequest configReq = new
SetBucketVersioningConfigurationRequest(bucketName, config);
s3.setBucketVersioningConfiguration(configReq);
PutObjectResult result = s3.putObject(new
PutObjectRequest(bucketName, key, createSampleFile("Program-
AWS-2")));
System.out.println("Version ID: "+result.getVersionId());
19
Operations on S3 Objects: GET
GET /isbn-12345 HTTP/1.1
Host: eorg-exercise3.s3.amazonaws.com
Date: Wed, 27 Oct 2010 12:00:00 GMT
Authorization: AWS 02236Q3V0WHVSRW0EXG2:0RQf4/cR…
String bucketName = "eorg-exercise3";
String key = "isbn-12345";
S3Object object = s3.getObject(new
GetObjectRequest(bucketName, key));
System.out.println("Content-Type: " +
object.getObjectMetadata().getContentType());
displayTextInputStream(object.getObjectContent());
20
Note: Access Control Lists
“Note: Bucket and object ACLs are completely
independent; an object does not inherit the ACL from its
bucket. For example, if you create a bucket and grant write
access to another user, you will not be able to access the
user's objects unless the user explicitly grants access. This
also applies if you grant anonymous write access to a
bucket. Only the user "anonymous" will be able to access
objects the user created unless permission is explicitly
granted to the bucket owner.
Important: We highly recommend that you do not grant the
anonymous group write access to your buckets as you will
have no control over the objects others can store and their
associated charges.”
21
Note: Mediated Access with Signed URLs
Gatekeeper
1.) Get signed URL
S3
2.) Retrieve S3 object
Cf. James Murty: “Programming Amazon Web Services”, fig. 4-2
22
Programming EC2
Introduction
23
Basic EC2 Concepts
EC2 Flow
Amazon Machine Images (AMIs)
Regions & Availability Zones
Run EC2 Instances
Terminate EC2 Instances
24
EC2 Flow
Source: EC2 Developer Guide 2010-08-3
25
Amazon Machine Images (AMIs)
Amazon Machine Images (AMIs) are virtual machine
images with a root device which is stored either in
Amazon S3, or
Amazon Elastic Block Store (EBS)
Pre-configured public AMIs are provided by the AWS
community
26
Amazon Machine Images (2)
27
Regions
“Amazon EC2 provides multiple Regions so you can
launch Amazon EC2 instances in locations that meet your
requirements. Each Amazon EC2 Region is designed to be
completely isolated from the other Amazon EC2 Regions.
This achieves the greatest possible failure independence
and stability, and it makes the locality of each EC2
resource unambiguous.”
28
Availability Zones
“[F]ailures can occur that affect the availability of instances
that are in the same location. Although this is rare, if you
host all your Amazon EC2 instances in a single location
that is affected by such a failure, your instances will be
unavailable.
For example, if you have instances distributed across three
Availability Zones and one of the instances fails, you can
design your application so the instances in the remaining
Availability Zones handle any requests.”
29
Run EC2 Instances (1)
ec2 = new AmazonEC2Client(credentials);
RunInstancesRequest req = new
RunInstancesRequest();
req.setImageId("ami-480df921");
req.setInstanceType("t1.micro");
req.setMinCount(1);
req.setMaxCount(1);
RunInstancesResult res =
ec2.runInstances(req);
System.out.println(res.toString());
30
Run EC2 Instances (2)
HTTP POST Request
https://ec2.amazonaws.com/?Action=RunInstances
&ImageId=ami-480df921
&MaxCount=1
&MinCount=1
&Placement.AvailabilityZone=eu-west-1b
&SignatureMethod=HmacSHA256
& AWSAccessKeyId=123
…
31
Run EC2 Instances (3)
AWS Management Console
Eclipse Management Console
32
Run EC2 Instances (4)
Run EC2 Instances in the EU Region
ec2 = new AmazonEC2Client(credentials);
ec2.setEndpoint("https://eu-west-
1.ec2.amazonaws.com");
...
Placement p = new Placement();
p.setAvailabilityZone("eu-west-1b");
req.setPlacement(p);
33
Don’t forget to terminate…
TerminateInstancesRequest req = new
TerminateInstancesRequest().withInstanceIds(id);
ec2.terminateInstances(req);
34
References
S3 Developer Guide 2006-03-01
S3 API Reference 2006-03-01
EC2 Developer Guide 2010-08-31
EC2 API Reference 2010-08-31

Más contenido relacionado

La actualidad más candente

2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing
Yu-Lin Huang
 

La actualidad más candente (20)

Amazon web service
Amazon web service Amazon web service
Amazon web service
 
EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel AvivEC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
EC2 Container Service - Distributed Applications at Scale - Pop-up Loft Tel Aviv
 
Cloud Architectures - Jinesh Varia - GrepTheWeb
Cloud Architectures - Jinesh Varia - GrepTheWebCloud Architectures - Jinesh Varia - GrepTheWeb
Cloud Architectures - Jinesh Varia - GrepTheWeb
 
The Cloud as a Platform - By Jinesh Varia
The Cloud as a Platform - By Jinesh VariaThe Cloud as a Platform - By Jinesh Varia
The Cloud as a Platform - By Jinesh Varia
 
Getting Started with AWS
Getting Started with AWSGetting Started with AWS
Getting Started with AWS
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Technical Track
Technical TrackTechnical Track
Technical Track
 
AWS Presentation
AWS PresentationAWS Presentation
AWS Presentation
 
2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing
 
RDS and DynamoDB - Module 3 Part 2 - AWSome Day 2017
RDS and DynamoDB - Module 3 Part 2 - AWSome Day 2017RDS and DynamoDB - Module 3 Part 2 - AWSome Day 2017
RDS and DynamoDB - Module 3 Part 2 - AWSome Day 2017
 
Best Practices for Getting Started with AWS
Best Practices for Getting Started with AWSBest Practices for Getting Started with AWS
Best Practices for Getting Started with AWS
 
Basics AWS Presentation
Basics AWS PresentationBasics AWS Presentation
Basics AWS Presentation
 
5 things you don't know about Amazon Web Services
5 things you don't know about Amazon Web Services5 things you don't know about Amazon Web Services
5 things you don't know about Amazon Web Services
 
Getting Started on AWS
Getting Started on AWS Getting Started on AWS
Getting Started on AWS
 
Intro to AWS: EC2 & Compute Services
Intro to AWS: EC2 & Compute ServicesIntro to AWS: EC2 & Compute Services
Intro to AWS: EC2 & Compute Services
 
Aws overview (Amazon Web Services)
Aws overview (Amazon Web Services)Aws overview (Amazon Web Services)
Aws overview (Amazon Web Services)
 
AWS 101 Event - 16 July 2013
AWS 101 Event - 16 July 2013AWS 101 Event - 16 July 2013
AWS 101 Event - 16 July 2013
 
ARC302 AWS Cloud Design Patterns - AWS re: Invent 2012
ARC302 AWS Cloud Design Patterns - AWS re: Invent 2012ARC302 AWS Cloud Design Patterns - AWS re: Invent 2012
ARC302 AWS Cloud Design Patterns - AWS re: Invent 2012
 
AWS Webcast - Best Practices in Architecting for the Cloud
AWS Webcast - Best Practices in Architecting for the CloudAWS Webcast - Best Practices in Architecting for the Cloud
AWS Webcast - Best Practices in Architecting for the Cloud
 
Securing The AWS Cloud, Steve Riley, AWS Events, April 2010
Securing The AWS Cloud, Steve Riley, AWS Events, April 2010Securing The AWS Cloud, Steve Riley, AWS Events, April 2010
Securing The AWS Cloud, Steve Riley, AWS Events, April 2010
 

Destacado

Destacado (20)

Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 
What is AWS?
What is AWS?What is AWS?
What is AWS?
 
Cloudschool 2014
Cloudschool 2014Cloudschool 2014
Cloudschool 2014
 
2011 Introduction to Cloud Computing and Amazon Web Services
2011 Introduction to Cloud Computing and Amazon Web Services2011 Introduction to Cloud Computing and Amazon Web Services
2011 Introduction to Cloud Computing and Amazon Web Services
 
AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)
 
How Does Amazon EC2 Auto Scaling Work
How Does Amazon EC2 Auto Scaling WorkHow Does Amazon EC2 Auto Scaling Work
How Does Amazon EC2 Auto Scaling Work
 
Cloudify your applications with Amazon Web Services
Cloudify your applications with Amazon Web ServicesCloudify your applications with Amazon Web Services
Cloudify your applications with Amazon Web Services
 
Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...Security Boundaries and Functions of Services for Serverless Architectures on...
Security Boundaries and Functions of Services for Serverless Architectures on...
 
CSI: Amazon Web Services
CSI: Amazon Web ServicesCSI: Amazon Web Services
CSI: Amazon Web Services
 
Building Web Scale Applications with AWS
Building Web Scale Applications with AWSBuilding Web Scale Applications with AWS
Building Web Scale Applications with AWS
 
Aws for Start-ups - Introduction & AWS Overview
Aws for Start-ups  - Introduction & AWS OverviewAws for Start-ups  - Introduction & AWS Overview
Aws for Start-ups - Introduction & AWS Overview
 
Auto scaling using Amazon Web Services ( AWS )
Auto scaling using Amazon Web Services ( AWS )Auto scaling using Amazon Web Services ( AWS )
Auto scaling using Amazon Web Services ( AWS )
 
What is Cloud Computing with Amazon Web Services?
What is Cloud Computing with Amazon Web Services?What is Cloud Computing with Amazon Web Services?
What is Cloud Computing with Amazon Web Services?
 
Overview of Amazon Web Services
Overview of Amazon Web ServicesOverview of Amazon Web Services
Overview of Amazon Web Services
 
Black Belt Online Seminar AWS Amazon S3
Black Belt Online Seminar AWS Amazon S3Black Belt Online Seminar AWS Amazon S3
Black Belt Online Seminar AWS Amazon S3
 
AWS re:Invent 2016: Auto Scaling – the Fleet Management Solution for Planet E...
AWS re:Invent 2016: Auto Scaling – the Fleet Management Solution for Planet E...AWS re:Invent 2016: Auto Scaling – the Fleet Management Solution for Planet E...
AWS re:Invent 2016: Auto Scaling – the Fleet Management Solution for Planet E...
 
Introduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesIntroduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web Services
 
AWS for Startups, London - Programming AWS
AWS for Startups, London - Programming AWSAWS for Startups, London - Programming AWS
AWS for Startups, London - Programming AWS
 
Day 5 - AWS Autoscaling Master Class - The New Capacity Plan
Day 5 - AWS Autoscaling Master Class - The New Capacity PlanDay 5 - AWS Autoscaling Master Class - The New Capacity Plan
Day 5 - AWS Autoscaling Master Class - The New Capacity Plan
 
Introduction to Cloud Computing with Amazon Web Services-ASEAN Workshop Serie...
Introduction to Cloud Computing with Amazon Web Services-ASEAN Workshop Serie...Introduction to Cloud Computing with Amazon Web Services-ASEAN Workshop Serie...
Introduction to Cloud Computing with Amazon Web Services-ASEAN Workshop Serie...
 

Similar a Programming Amazon Web Services for Beginners (1)

Similar a Programming Amazon Web Services for Beginners (1) (20)

Aws oct18
Aws oct18Aws oct18
Aws oct18
 
The IoT Academy_awstraining_part2_aws_ec2_iaas
The IoT Academy_awstraining_part2_aws_ec2_iaasThe IoT Academy_awstraining_part2_aws_ec2_iaas
The IoT Academy_awstraining_part2_aws_ec2_iaas
 
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
 
Architecting for the Cloud: Best Practices
Architecting for the Cloud: Best PracticesArchitecting for the Cloud: Best Practices
Architecting for the Cloud: Best Practices
 
Secure perimeter with AWS workspaces
Secure perimeter with  AWS workspacesSecure perimeter with  AWS workspaces
Secure perimeter with AWS workspaces
 
CloudFork
CloudForkCloudFork
CloudFork
 
Amazon s3ec2
Amazon s3ec2Amazon s3ec2
Amazon s3ec2
 
Ultimate Guide to Incident Response in AWS.pdf
Ultimate Guide to Incident Response in AWS.pdfUltimate Guide to Incident Response in AWS.pdf
Ultimate Guide to Incident Response in AWS.pdf
 
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh VariaAWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
AWS Architecting Cloud Apps - Best Practices and Design Patterns By Jinesh Varia
 
Amazon Aws Presentation Drupal
Amazon Aws Presentation DrupalAmazon Aws Presentation Drupal
Amazon Aws Presentation Drupal
 
Amazon ECS Container Service Deep Dive
Amazon ECS Container Service Deep DiveAmazon ECS Container Service Deep Dive
Amazon ECS Container Service Deep Dive
 
AWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and DockerAWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and Docker
 
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
 
A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)
 
Architecting Cloud Apps
Architecting Cloud AppsArchitecting Cloud Apps
Architecting Cloud Apps
 
AWS Summit Sydney 2014 | Running your First Application on AWS
AWS Summit Sydney 2014 | Running your First Application on AWSAWS Summit Sydney 2014 | Running your First Application on AWS
AWS Summit Sydney 2014 | Running your First Application on AWS
 
AWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 MasterclassAWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 Masterclass
 
Aws primer Amazon Web Services
Aws primer Amazon Web ServicesAws primer Amazon Web Services
Aws primer Amazon Web Services
 
Aws
AwsAws
Aws
 
Scaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloudScaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloud
 

Último

Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Sheetaleventcompany
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
amitlee9823
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
Matteo Carbone
 

Último (20)

A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
John Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdfJohn Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdf
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 

Programming Amazon Web Services for Beginners (1)

  • 1. 1 Programming Amazon Web Services with Java & Eclipse - Short Tutorial - by Markus Klems markus.klems@kit.edu
  • 2. 2 Amazon Web Service Developer Ecosystem Java • AWS Java libraries • AWS toolkit for Eclipse • … Ruby • Ruby gems (RightScale, amazon-ec2, AWS::S3) • … PHP • AWS PHP libraries • Zend Web development framework supports S3, EC2 & SQS • … .NET • AWS SDK for .NET (libraries, Visual Studio templates) • Windows on EC2 • … FOCUS … and more.
  • 3. 3 AWS Software Development with Java AWS Java libraries Jets3t (James Murty) Open-source Java toolkit and application suite for Amazon S3 and CloudFront http://bitbucket.org/jmurty/jets3t/wiki/Home Typica (D. Kavanagh, Xerox Corporation) Open-Source Java libraries for a broad variety of Amazon Web Services http://code.google.com/p/typica/ Amazon SDK for Java Open-source Java libraries for a broad variety of Amazon Web Services http://aws.amazon.com/sdkforjava/ AWS toolkit for Eclipse Eclipse Plug-in AWS perspective with views “EC2 Instances”, “EC2 AMIs”, et cetera AWS Project Wizard
  • 4. 4 AWS Toolkit for Eclipse (1) Source:www.eclipse.org/downloads/,April2010
  • 5. 5 AWS Toolkit for Eclipse (2) 1) Go to “Help” > “Install New Software…” 2) Enter http://aws.amazon.com/eclipse Source:aws.amazon.com/eclipse/,April2010
  • 6. 6 AWS Toolkit for Eclipse (3) Source:aws.amazon.com/eclipse/,April2010
  • 7. 7 AWS Toolkit for Eclipse (4) Source:aws.amazon.com/eclipse/,April2010
  • 9. 9 Amazon Web Service Credentials
  • 11. 11 Basic S3 Concepts Buckets HTTP PUT HTTP GET Objects HTTP PUT HTTP GET
  • 12. 12 S3 Buckets DNS-compatible bucket names Bucket names must be unique in the S3 universe Bucket names should not contain underscores (_) Bucket names should be between 3 and 63 characters long Bucket names should not end with a dash Bucket names cannot contain two, adjacent periods Bucket names cannot contain dashes next to periods (e.g., "my- .bucket.com" and "my.-bucket" are invalid)
  • 13. 13 Operations on Buckets: PUT PUT: Create a new bucket PUT / HTTP/1.1 Host: eorg-exercise1.s3.amazonaws.com Content-Length: 0 Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf… s3.createBucket(“eorg-exercise1");
  • 14. 14 Operations on Buckets: PUT (2) Set the Bucket Region PUT / HTTP/1.1 Host: eorg-exercise2.s3.amazonaws.com Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3Y… Content-Type: text/plain Content-Length: 124 <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <LocationConstraint>EU</LocationConstraint> </CreateBucketConfiguration > CreateBucketRequest request = new CreateBucketRequest("eorg-exercise2"); request.setRegion("EU"); s3.createBucket(request);
  • 15. 15 Operations on Buckets: PUT (3) Set Access Control String bucketName = "eorg-exercise3"; CannedAccessControlList acl = CannedAccessControlList.PublicRead; s3.createBucket(bucketName); s3.setBucketAcl(bucketName, acl); PUT / HTTP/1.1 Host: eorg-exercise3.s3.amazonaws.com Content-Length: 0 x-amz-acl: public-read Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep…
  • 16. 16 Operations on Buckets: GET (1) Return all (up to 1000) of the objects in a bucket GET / HTTP/1.1 Host: eorg-exercise3.s3.amazonaws.com Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep… Content-Type: text/plain String bucketName = "eorg-exercise3"; ObjectListing list = s3.listObjects(new ListObjectsRequest().withBucketName(bucketName)); for (S3ObjectSummary s : list.getObjectSummaries()) { System.out.println(" - " + s.getKey() + “ (size = " + s.getSize() + ")"); }
  • 17. 17 Operations on S3 Objects: PUT (1) PUT /isbn-12345 HTTP/1.1 Host: eorg-exercise3.s3.amazonaws.com Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRep… Content-Type: text/plain Content-Length: 135 Content-MD5: JBVusP8u0QVhBvsvxNDthQ== […data…] String bucketName = "eorg-exercise3"; String key = "isbn-12345"; s3.putObject(new PutObjectRequest(bucketName, key, createSampleFile(“Program-AWS")));
  • 18. 18 Operations on S3 Objects: PUT (2) Object Versioning BucketVersioningConfiguration config = new BucketVersioningConfiguration(); config.setStatus(BucketVersioningConfiguration.ENABLED); SetBucketVersioningConfigurationRequest configReq = new SetBucketVersioningConfigurationRequest(bucketName, config); s3.setBucketVersioningConfiguration(configReq); PutObjectResult result = s3.putObject(new PutObjectRequest(bucketName, key, createSampleFile("Program- AWS-2"))); System.out.println("Version ID: "+result.getVersionId());
  • 19. 19 Operations on S3 Objects: GET GET /isbn-12345 HTTP/1.1 Host: eorg-exercise3.s3.amazonaws.com Date: Wed, 27 Oct 2010 12:00:00 GMT Authorization: AWS 02236Q3V0WHVSRW0EXG2:0RQf4/cR… String bucketName = "eorg-exercise3"; String key = "isbn-12345"; S3Object object = s3.getObject(new GetObjectRequest(bucketName, key)); System.out.println("Content-Type: " + object.getObjectMetadata().getContentType()); displayTextInputStream(object.getObjectContent());
  • 20. 20 Note: Access Control Lists “Note: Bucket and object ACLs are completely independent; an object does not inherit the ACL from its bucket. For example, if you create a bucket and grant write access to another user, you will not be able to access the user's objects unless the user explicitly grants access. This also applies if you grant anonymous write access to a bucket. Only the user "anonymous" will be able to access objects the user created unless permission is explicitly granted to the bucket owner. Important: We highly recommend that you do not grant the anonymous group write access to your buckets as you will have no control over the objects others can store and their associated charges.”
  • 21. 21 Note: Mediated Access with Signed URLs Gatekeeper 1.) Get signed URL S3 2.) Retrieve S3 object Cf. James Murty: “Programming Amazon Web Services”, fig. 4-2
  • 23. 23 Basic EC2 Concepts EC2 Flow Amazon Machine Images (AMIs) Regions & Availability Zones Run EC2 Instances Terminate EC2 Instances
  • 24. 24 EC2 Flow Source: EC2 Developer Guide 2010-08-3
  • 25. 25 Amazon Machine Images (AMIs) Amazon Machine Images (AMIs) are virtual machine images with a root device which is stored either in Amazon S3, or Amazon Elastic Block Store (EBS) Pre-configured public AMIs are provided by the AWS community
  • 27. 27 Regions “Amazon EC2 provides multiple Regions so you can launch Amazon EC2 instances in locations that meet your requirements. Each Amazon EC2 Region is designed to be completely isolated from the other Amazon EC2 Regions. This achieves the greatest possible failure independence and stability, and it makes the locality of each EC2 resource unambiguous.”
  • 28. 28 Availability Zones “[F]ailures can occur that affect the availability of instances that are in the same location. Although this is rare, if you host all your Amazon EC2 instances in a single location that is affected by such a failure, your instances will be unavailable. For example, if you have instances distributed across three Availability Zones and one of the instances fails, you can design your application so the instances in the remaining Availability Zones handle any requests.”
  • 29. 29 Run EC2 Instances (1) ec2 = new AmazonEC2Client(credentials); RunInstancesRequest req = new RunInstancesRequest(); req.setImageId("ami-480df921"); req.setInstanceType("t1.micro"); req.setMinCount(1); req.setMaxCount(1); RunInstancesResult res = ec2.runInstances(req); System.out.println(res.toString());
  • 30. 30 Run EC2 Instances (2) HTTP POST Request https://ec2.amazonaws.com/?Action=RunInstances &ImageId=ami-480df921 &MaxCount=1 &MinCount=1 &Placement.AvailabilityZone=eu-west-1b &SignatureMethod=HmacSHA256 & AWSAccessKeyId=123 …
  • 31. 31 Run EC2 Instances (3) AWS Management Console Eclipse Management Console
  • 32. 32 Run EC2 Instances (4) Run EC2 Instances in the EU Region ec2 = new AmazonEC2Client(credentials); ec2.setEndpoint("https://eu-west- 1.ec2.amazonaws.com"); ... Placement p = new Placement(); p.setAvailabilityZone("eu-west-1b"); req.setPlacement(p);
  • 33. 33 Don’t forget to terminate… TerminateInstancesRequest req = new TerminateInstancesRequest().withInstanceIds(id); ec2.terminateInstances(req);
  • 34. 34 References S3 Developer Guide 2006-03-01 S3 API Reference 2006-03-01 EC2 Developer Guide 2010-08-31 EC2 API Reference 2010-08-31

Notas del editor

  1. If you follow the DNS-compatible naming constraints you can use all S3 features because the rules restrict to names that are valid in the DNS naming system. If you follow less constrained naming rules, you cannot use all features: e.g. different availability zones (outside the US) Buckets with names containing uppercase characters are not accessible using the virtual hosted-style request (e.g., http://yourbucket.s3.amazonaws.com/yourobject) If you create a bucket using <CreateBucketConfiguration>, you must follow the DNS guidelines. If you create a bucket using <CreateBucketConfiguration>, applications that access your bucket must be able to handle 307 redirects. For more information, see Request Redirection and the REST API (p. 99). When using virtual hosted-style buckets with SSL, the SSL wild card certificate only matches buckets that do not contain periods. To work around this, use HTTP or write your own certificate verification logic.
  2. Amazon EC2 provides multiple Regions so you can launch Amazon EC2 instances in locations that meet your requirements. For example, you might want to launch instances in Europe to be closer to your European customers or to meet legal requirements. Each Amazon EC2 Region is designed to be completely isolated from the other Amazon EC2 Regions. This achieves the greatest possible failure independence and stability, and it makes the locality of each EC2 resource unambiguous. To launch or work with instances, you must specify the correct Region URL endpoint. For example, to access the US-East Region (default), you make service calls to the ec2.us-east-1.amazonaws.com service endpoint. The following table lists the Regions and associated endpoints.
  3. Amazon EC2 provides multiple Regions so you can launch Amazon EC2 instances in locations that meet your requirements. For example, you might want to launch instances in Europe to be closer to your European customers or to meet legal requirements. Each Amazon EC2 Region is designed to be completely isolated from the other Amazon EC2 Regions. This achieves the greatest possible failure independence and stability, and it makes the locality of each EC2 resource unambiguous. To launch or work with instances, you must specify the correct Region URL endpoint. For example, to access the US-East Region (default), you make service calls to the ec2.us-east-1.amazonaws.com service endpoint. The following table lists the Regions and associated endpoints.