34,79 €
Expert AWS Development begins with the
installation of the AWS SDK and you will go
on to get hands-on experience of creating
an application using the AWS Management
Console and the AWS Command Line
Interface (CLI). Then, you will integrate
applications with AWS services such as
DynamoDB, Amazon Kinesis, AWS Lambda,
Amazon SQS, and Amazon SWF.
Following this, you will get well versed with
CI/CD workflow and work with four major
phases in the release process – Source,
Build, Test, and Production. Then, you will
learn to apply AWS Developer tools to your
Continuous Integration (CI) and Continuous
Deployment (CD) workflow. Later, you
will learn about user authentication using
Amazon Cognito, and also how you can
evaluate the best architecture as per your
infrastructure costs. You will learn about
Amazon EC2 service and will deploy an
app using it. You will also deploy a practical
real-world example of a CI/CD application
with the Serverless Application Framework,
which is known as AWS Lambda.
Finally, you will learn how to build, develop,
and deploy the Application using AWS
Developer tools such as AWS CodeCommit,
AWS CodeBuild, AWS CodeDeploy, and
AWS CodePipeline, as per your project
requirements.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 376
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin BorichaAcquisition Editor: Meeta RajaniContent Development Editor: Devika BattikeTechnical Editor:Prachi SawantCopy Editor:Safis EditingProject Coordinator: Judie JoseProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Tom ScariaProduction Coordinator: Arvindkumar Gupta
First published: March 2018
Production reference: 1280318
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78847-758-1
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Atul V. Mistry holds all three AWS Associate certifications and has been a winner at AWS IoT HackDay, 2017 event in Singapore. He has worked consistently with AWS and on software design and development with JEE technology. He has diverse work experience, having worked around the globe, and participated extensively in cross-functional project delivery in the finance industry.
Miguel Angel Sanchez Marti has 4 years' experience of architecting solutions in AWS, having worked for many clients. Currently, he's a business consultant at Datadec, which has migrated most of its clients from on-premise to cloud solutions. They're involved in delivering the latest technology and he is in charge of developing AI and machine learning solutions for their clients.
He has been an AWS Certified Solutions Architect since June 2016. He was involved in many software projects working for Binn.es as a software project manager.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Expert AWS Development
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
AWS Tools and SDKs
Brief introduction to AWS tools and SDKs
AWS SDK for Java
AWS SDK for Java using Apache Maven
Configuring an SDK as a Maven dependency
AWS SDK for Java using Gradle
AWS SDK for Java using Eclipse IDE
AWS SDK for Node.js
AWS SDKs for IoT devices
AWS SDKs for mobile devices
AWS Mobile SDK for Android
AWS Mobile SDK setup for Android
Configuring AWS Mobile SDK for Android
Using Amazon Cognito to set AWS credentials
Summary
Integrating Applications with AWS Services
Amazon DynamoDB
Integrating DynamoDB into an application
Low-level interface
Document interface
Object persistence (high-level) interface
DynamoDB low-level API
Troubleshooting in Amazon DynamoDB
Amazon Kinesis
Amazon Kinesis streams
Troubleshooting tips for Kinesis streams
Amazon Kinesis Firehose
Troubleshooting tips for Kinesis Firehose
Amazon SQS
Benefits and features of Amazon SQS
Troubleshooting in Amazon SQS
Amazon SWF
AWS SWF components
Amazon SWF examples
AWS SDK for Java using Apache Maven
Workflow implementations
Building and running a project
Troubleshooting Amazon SWF
Unknown resource fault
Non-deterministic workflows
Versioning problems
Troubleshooting and debugging a workflow execution
Lost tasks
Summary
Continuous Integration and Continuous Deployment Workflow
An overview of DevOps
The goal of DevOps
Reasons for integrating DevOps in your process  
The benefits of DevOps
Continuous Integration – maintaining code repository
Continuous Integration best practices
Continuous Delivery – automating build and self-testing
Continuous Delivery benefits
Continuous Deployment – automating production deployment
How they work together
The benefits of Continuous Deployment
Tools used for DevOps processes
Source Code Management
GIT
Bitbucket
Subversion (SVN)
Build Automation tool
Maven
Ant
Gradle
Test automation
Selenium
JUnit
Cucumber
Continuous Integration
Jenkins
Bamboo
Hudson
Configuration Management
Puppet
Chef
Ansible
Continuous Monitoring
Nagios
Ganglia
Sensu
Virtual Infrastructure
CI/CD on AWS
Summary
CI/CD in AWS Part 1 – CodeCommit, CodeBuild, and Testing
A brief overview of AWS for DevOps
AWS CodeCommit – maintaining code repository
Prerequisites of AWS CodeCommit
AWS CodeCommit setup using Git credentials
AWS CodeCommit setup using other methods
Getting started with AWS CodeCommit
AWS CodeBuild – automating the build
AWS CodeBuild benefits
AWS CodeBuild features
Creating AWS CodeBuild project using AWS Management Console
List of build project names
Viewing the build project's details
Updating the build project's details
Deleting the build project
Summary
CI/CD in AWS Part 2 – CodeDeploy, CodePipeline, and CodeStar
AWS CodeDeploy
AWS CodeDeploy benefits
Compute platforms and deployment options for AWS CodeDeploy
Compute platforms
Deployment options
AWS CodeDeploy – sample application deployment on a Windows Server
Step 1 – prerequisite configurations for AWS CodeDeploy
Step 2 – launch a Windows Server Amazon EC2 instance
Step 3 – configure source content to deploy to the EC2 instance
Step 4 – upload application to Amazon S3
Provision of S3 bucket with IAM user permission
Preparation and bundling of the application's file and pushing to the S3 bucket
Step 5 – deploy application
To deploy and monitor the application from AWS CLI
To deploy and monitor the application from AWS Management Console
Step 6 – update and redeploy application
Step 7 – clean up the application and related resources
AWS CodePipeline
AWS CodePipeline benefits
AWS CodePipeline features
Creating an AWS CodePipeline from the console
Creating an AWS CodePipeline from AWS CLI
JSON file creation
Execution of the create-pipeline command
AWS CodeStar
Creating a project in AWS CodeStar
AWS X-Ray
AWS X-Ray benefits
Key features of AWS X-Ray
Creating an AWS X-Ray example from the console
Summary
User Authentication with AWS Cognito
Amazon Cognito benefits
Amazon Cognito features
Amazon Cognito User Pools
Getting started with Amazon Cognito User Pools
Amazon Cognito User Pool creation from the console
Amazon Cognito example for Android with mobile SDK
Amazon Cognito Federated Identities
Creating a new Identity Pool from the console
Amazon Cognito Sync
Summary
Evaluating the Best Architecture
The comparison of traditional web hosting versus web hosting on the cloud using AWS
Traditional web hosting
Challenges with traditional hosting
Cloud hosting
The AWS solution for common web hosting
AWS Well-Architected framework
Amazon EC2 instance and Elastic Load Balancer
Benefits and drawbacks of Amazon EC2
Elastic Load Balancing
Docker with the Amazon EC2 Container Service (Amazon ECS)
Use case of Docker
Containers
Amazon ECS
Serverless architecture with Lambda
Use cases for different architectures
Controlling and optimizing costs
Summary
Traditional Web Hosting – Amazon EC2 and Elastic Load Balancing
Amazon EC2 best practices
Troubleshooting instances
Instance terminates immediately
Errors when connected to an instance
Troubleshooting stopping your instance
Troubleshooting terminating (shutting down) your instance
Troubleshooting instance recovery failures
Troubleshooting instances with failed status checks
Troubleshooting instance capacity
Getting console output and rebooting instances
My instance is booting from the wrong volume
Troubleshooting Windows instances
Elastic Load Balancing, auto scaling, and fault tolerant
Features of ELB
Benefits of Application Load Balancer 
Benefits of Network Load Balancer 
Benefits of Classic Load Balancer 
Auto scaling and fault tolerance
Fault tolerance in AWS for Amazon EC2
Monitoring and optimizing the cost of the EC2 infrastructure
Cost efficient resources
Supply-demand matching
Know your expenses
Optimization over time
Continuous Integration and Continuous Deployment workflow
Summary
Amazon EC2 Container Service
Docker
Container instances
Basic concepts of a container instance
Life cycle of a container instance
Checking the instance role for the account
AMIs for a container instance
Update notification subscribing to Amazon ECS–optimized AMI
Launching an Amazon ECS container instance
Bootstrapping container instances with Amazon EC2 user data
Connecting your container instance
Container instances with CloudWatch Logs
Container instance draining
Remotely managing your container instance
Deregistering your container instance
Amazon ECS clusters
Cluster concepts
Creating a cluster
Scaling a cluster
Deleting a cluster
Scheduling tasks
Service scheduler
Manually running tasks
Running tasks on a cron-like schedule
Custom schedulers
Task life cycle
Task retirement
Windows containers (beta)
Windows container concepts
A web application with Windows containers
Create a Windows cluster
Launch a Windows container instance into the cluster
Register a task definition for Windows
Create a service with the task definition
View the service
Monitoring and optimizing the cost of the infrastructure
Continuous Integration (CI) and Continuous Deployment (CD) Workflow
Step 1 – addding required files source repository
Step 2 – creating a Continuous Deployment pipeline
Step 3 – adding Amazon ECR permissions to the AWS CodeBuild role
Step 4 – testing your pipeline
Summary
Amazon Lambda – AWS Serverless Architecture
Microservices architecture
Microservice characteristics
Lambda and Lambda@Edge advanced topics and best practices
Environment variables
Setting up
Naming convention rules for environment variables
Environment variables and function versioning
Environment variable encryption
Error scenarios
Dead letter queues (DLQ)
Best practices for working with AWS Lambda functions
Function code
Function configuration
Alarming and metrics
Stream event invokes
Async invokes
Lambda VPC
Lambda@Edge
Lambda@Edge benefits
AWS Serverless Application Model (SAM)
Deploying with AWS SAM and AWS CloudFormation
Packaging and deployment
Packaging
Deployment
Introducing the Serverless Application Framework
What makes an application serverless?
Serverless applications benefits
The Serverless Framework
Serverless Framework benefits
Monitoring and optimizing the cost of the infrastructure
How does Lambda pricing work?
How do you keep AWS Lambda costs down?
CI and CD workflow
Step 1 – setting up the repository
Step 2 – creating the pipeline
Step 3 – modifying the generated policy
Step 4 – completing your deployment stage
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
Continuous Integration/Continuous Deployment and the Agile methodology have enabled huge advances in modern applications. This book will enable the reader to make use of these rapidly evolving technologies to build highly scalable applications within AWS using different architectures.
You will begin by installing the AWS SDK and will then get hands-on experience of creating an application using the AWS Management Console and the AWS Command Line Interface (CLI). Next, you will be integrating Applications with AWS services such as DynamoDB, Amazon Kinesis, AWS Lambda, Amazon SQS, and Amazon SWF.
Following this, you will get well versed with CI/CD workflow and work with four major phases in the release processes—Source, Build, Test, and Production. Next, you will learn to apply AWS Developer tools in your Continuous Integration (CI) and Continuous Deployment (CD) workflow. Later, you will learn about user authentication using Amazon Cognito and also how you can evaluate the best architecture as per your infrastructure costs. You will learn about Amazon EC2 and deploy an app using it. You will also get well versed with container service, which is Amazon EC2 Container Service (Amazon ECS), and you will learn how to deploy an app using it. Along with EC2 and ECS, you will also deploy a practical real-world example of a CI/CD application with the Serverless Application Framework, which is known as AWS Lambda. Finally, you will learn how to build, develop, and deploy an application using AWS Developer tools such as AWS CodeCommit, AWS CodeBuild, AWS CodeDeploy, and AWS CodePipeline as per your project needs. You will also be able to develop and deploy applications within minutes using AWS CodeStar from the wizard.
By the end of this book, you will be able to effectively build, deploy, and manage applications on AWS along with scaling and securing applications with best practices and troubleshooting tips.
This book targets developers who would like to build and manage web and mobile applications and services on the AWS platform. If you are an architect, you will be able to deep dive and use examples that can be readily applied to real-world scenarios. Some prior programming experience is assumed, along with familiarity with cloud computing.
Chapter 1, AWS Tools and SDKs, introduces the AWS SDK and covers installation and the programming languages that are supported. The reader will get hands-on experience of creating an application. This chapter also covers SDKs for IoT devices and mobiles.
Chapter 2, Integrating Applications with AWS Services, covers how to integrate applications with AWS services such as DynamoDB, Amazon Kinesis, AWS Lambda, Amazon SQS, and Amazon SWF.
Chapter 3, Continuous Integration and Continuous Deployment Workflow, introduces the four major phases in the release processes—Source, Build, Test, and Production.
Chapter 4, CI/CD in AWS Part 1 – CodeCommit, CodeBuild, and Testing, explains how to apply AWS developer tools in your Continuous Integration (CI) and Continous Deployment (CD) workflow.
Chapter 5, CI/CD in AWS Part 2 – CodeDeploy, CodePipeline, and CodeStar, discusses other AWS Code family tools such as AWS CodeDeploy, AWS CodePipeline, AWS CodeStar, and AWS X-Ray.
Chapter 6, User Authentication with AWS Cognito, explains how to manage user authentication with AWS Cognito and also covers AWS Cognito service, which is a simple and secure user authentication for mobile and web applications.
Chapter 7, Evaluating the Best Architecture, covers traditional web hosting and web hosting on the cloud using AWS discussing, the best architecture for applications.
Chapter 8, Traditional Web Hosting – Amazon EC2 and Elastic Load Balancing, discusses Amazon EC2 best practices and troubleshooting. The chapter also covers about Elastic Load Balancing, auto-scaling, and fault-tolerant advanced topics. Finally, we will deploy an example of a CI/CD application using Amazon EC2 instances.
Chapter 9, Amazon EC2 Container Service, covers Docker, container instances, clusters, scheduling Ttsks, and Windows containers. Then, we will deploy an example of a CI/CD application with Amazon EC2 container services.
Chapter 10, Amazon Lambda – AWS Serverless Architecture, goes into more detail more about Microservices, Serverless Framework, how you can achieve serverless on the AWS platform using AWS Lambda, and you will learn how to deploy applications with the AWS Serverless Application Model (SAM).
This book assumes that readers are already familiar with the basics of Amazon Web Services (AWS) and have some development background. It explains readers about Continuous Integration (CI) and Continuous Deployment (CD) and how they are achieved on AWS using Developer tools. Readers will also learn about different architectures and implement CI/CD on these architectures. Some of the troubleshooting and cost optimization tips are really helpful to the users while using different AWS services. Users can use free-tier cloud providers wherever possible; certain services might cost a small amount of money.
From a hardware point of view, you can work on any modern computer running for any operating system supported by AWS.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Expert-AWS-Development. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/ExpertAWSDevelopment_ColorImages.pdf.
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "You will see pom.xml file will be generated under ..\AWS SDK Example\javamaven-demo folder."
A block of code is set as follows:
<dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk</artifactId> <version>1.11.106</version></dependency>
Any command-line input or output is written as follows:
mvn clean compile exec:java
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Once you click on Install New Software it will open Available Software dialog box."
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
Most probably, if you are reading this book, you are a code-drink lover who is trying to explore or probably using Amazon Web Services (AWS). AWS contains around 20 different kinds of category/product, which have 110+ services. In this chapter, we will explore AWS tools and SDKs, which are under the Developer tools category of AWS products.
In the software world, a software development kit is known asSDK. It includes software development tools that allow you to create applications, software packages, frameworks, computer systems, gaming consoles, hardware platforms, operating systems, or similar kinds of software/hardware development platforms. Some SDKs are useful for developing platform-specific applications; for example, for Android applications on Java, you need the Java Development Kit(JDK) and for iOS applications, you need the iOS SDK. This is the basic idea of SDKs.
AWS also provides primary developer tools, command-line tools, toolkits, and SDKs to develop and manage AWS applications. It provides a variety of tools and SDKs as per the programming knowledge and project needs. With the help of these tools and SDKs, you can quickly and easily build and manage great applications on the AWS Cloud. This chapter will show you how to install and use these SDKs for different programming languages.
By the end of this chapter, you will understand how to install AWS SDKs and use them for development in different programming languages.
This chapter will cover the following topics:
Brief introduction to AWS tools and SDKs
AWS SDK for Java
AWS SDK for Java using Apache Maven
Configuring an SDK as a Maven dependency
AWS SDK for Java using Gradle
AWS SDK for Java using Eclipse IDE
AWS SDK for Node.js
As we discussed in the introduction, AWS provides developer and command-line tools, toolkits, and SDKs to develop and manage AWS applications. Currently, AWS provides nine SDKs for different programming languages, six SDKs for IoT devices, and five SDKs for mobile devices. Let's take a brief look at this:
Developer tools
: Developer tools are used to store source code securely and version-control it. They also help with build automation and testing and deploying applications to AWS or on-premise. They include the AWS CodeCommit, AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy services. We will cover these in
Chapter 4
,
CI/CD in AWS Part 1 – CodeCommit, CodeBuild, and Testing
and
Chapter 5
,
CI/CD in AWS Part 2 – CodeDeploy
,
CodePipeline
, and
CodeStar
.
SDKs
: They provide APIs for programming languages, IoT, and mobile devices.
IDE toolkits
: Cloud tools which can integrate to your integrated development environment to speed up your AWS development.
Command line
: This is used to control AWS services from the command line and create scripts for automated service management.
Serverless development
: Serverless applications built on AWS Lambda can test and deploy using AWS
Serverless Application Model
(
SAM
) and SAM Local. We will cover Amazon Lambda in
Chapter 10
,
Amazon Lambda – AWS Serverless Architecture
.
AWS provides SDKs for the different languages and hardware devices to connect AWS IoT and mobile devices.
The following are the different kinds of SDK. In this chapter, we will cover two programming language SDKs, Java and Node.js:
Please perform the following steps to include AWS SDK for Java using Apache Maven.
Assuming that you have already installed Maven in your machine, create a new folder called
AWS SDK Example
or any name. Go to this folder and execute the following command to set up the environment:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart
After it has successfully executed, you will see the following folder structure under the
AWS SDK Example
folder:
You will see the pom.xml file generated under the ..\AWS SDK Example\java-maven-demo folder.
I am assuming that you have already installed Eclipse 4.4 (Luna) or a higher version on your machine as the AWS toolkit supports that.
There are two ways to install an AWS toolkit in your IDE:
Click on
Help
|
Install New Software…
and install
Click on
Help
|
Eclipse Marketplace
, search for
AWS
, and install
We will install using the first method. Now please perform the following steps and refer to the following screenshot:
Once you click on
Install New Software
, it will open the
Available Software
dialog box.
In this dialog box, you have to click on
Add
to add the AWS toolkit.
It will open the
Add Repository
dialog box.
In this dialog box, add the
Name
and
Location
as
https://aws.amazon.com/eclipse
.
Click on
OK
.
On the next page, you will see all available AWS tools. You can select
AWS Core Management Tools
and other tools as per your project requirements:
A preview page will display to confirm the installation details. Click on
Next
and you will see the
Review License
page, where you click
Accept
and
Finish
to complete the AWS installation:
After successful installation, your IDE will restart. After restarting, you will see the AWS toolkit icon in the toolbar:
Now let's create a sample AWS Java project. When you click
New AWS Java Project….
, you will see the following screen. You need to add the necessary details for the project. Here I have used
S3Demo
as my
Project name
,
com.packt
as my
Group ID
, and
examples
as my
Artifact ID
. I have selected
Amazon S3 Sample
from the Java samples:
If you want to add new AWS accounts, click on the
Configure AWS accounts…
link. You can add the credentials in two ways:
Add
Profile Name
,
Access Key ID
, and
Secret Access Key
under the
Profile Details
screen.
You can specify your credentials file path or browse to your credentials file. Once you have added that, you can select
Apply and Close
:
Now it will generate the projects and create the necessary files. You can see the following screen with generated files. It will generate a
S3Sample.java
file. You can right-click on this file and select
Run As
|
Java Application
. It will create the bucket, list the bucket, upload a new object to S3, download an object, list an object, delete an object, and delete the bucket:
So far, you have learned how to add the AWS Java toolkit into your project using Maven, Gradle, and Eclipse IDE. Now we will see how to add the AWS SDK for Node.js into your project.
IoT is the Internet of Things, where the internet is connected with things such as software, hardware, physical devices, home appliances, vehicles, or any kind of sensor, actuator, or network, and exchanges data between them. In simple terms, your thing or device will collect, sense, and act on data and send it to an other device from the internet. These connected devices are communicating with each other from various technologies and flow data autonomously. IoT devices can be useful for consumer applications, enterprise applications, smart homes, agriculture, and many industries.
AWS provides different kinds of SDK for the IoT to connect securely and seamlessly to your hardware devices.
The following are the different kinds of AWS SDK:
AWS provides different kinds of SDKs to connect securely and seamlessly to your mobile devices.
The following are the different kinds of AWS SDKs. In this chapter, we will cover AWS SDK for Android:
For Android, AWS provides an open source SDK that is distributed under an Apache license. This will provide libraries, code examples, and documentation to develop mobile applications using AWS.
Currently, AWS supports the following services for AWS Mobile SDK for Android:
Amazon Cognito Identity
:
Controls authentication and provides temporary credentials to connect devices and/or other untrusted environments
Saves user data and synchronizes it
Manages identity throughout the lifetime of an application
We will discuss this topic in more detail in
Chapter 6
,
User Authentication with AWS Cognito
Amazon Cognito Sync
:
Enables application-specific data to sync on cross-devices
Syncs user data across the web and devices
Caches data locally so the device can access data offline; it can sync when the device is online
Notifies other devices if sync push is set up
Mobile Analytics
:
Collects, analyzes, visualizes, and understand the apps
Generates reports for users, sessions, in-app revenues, and events
Filters reports by data range and platform
Amazon S3
:
Mobile apps can directly access Amazon S3 to store data
Provides Transfer Utility/Transfer Manager (Older Version) to consume S3 services
DynamoDB
:
SDK contains a high-level library to access and work with DynamoDB Object Mapper
Can perform CRUD operations such as Create, Read, Update, and Delete for client-class
Amazon Kinesis
:
Provides simple, high-level design
Stores real-time data on disk and sends it all together to save battery life
Lambda
:
Lambda function receives app and device data to create a personalized and rich app experience
Amazon Lex
:
You can integrate a chat box on mobile devices
Amazon Polly
:
Mobile SDK provides add text to speech integration for Amazon Polly
Amazon Pinpoint
:
Integrates Amazon Pinpoint to send push notification campaigns from Android apps
Now let's understand how to set up the AWS Mobile SDK and then we will see an example with Amazon S3.
The AWS Mobile SDK is available at the following two resources for download:
http://sdk-for-android.amazonwebservices.com/latest/aws-android-sdk.zip
https://github.com/aws/aws-sdk-android
This SDK includes class libraries, code example, and documentation:
Class libraries will include the Java Archive Files (
.jar
) files for the AWS services. You can include the class for the service which you are using in your applications.
The code example provides you with an example of using the service in your application using class libraries.
Documentation is reference material for the use of AWS Mobile SDK for Android.
In the next section, you will see how to set up AWS Mobile SDK for Android.
