Posts Tagged ‘EC2’
[DevoxxFR 2018] Deploying Microservices on AWS: Compute Options Explored at Devoxx France 2018
At Devoxx France 2018, Arun Gupta and Tiffany Jernigan, both from Amazon Web Services (AWS), delivered a three-hour deep-dive session titled Compute options for Microservices on AWS. This hands-on tutorial explored deploying a microservices-based application using various AWS compute options: EC2, Amazon Elastic Container Service (ECS), AWS Fargate, Elastic Kubernetes Service (EKS), and AWS Lambda. Through a sample application with web app, greeting, and name microservices, they demonstrated local testing, deployment pipelines, service discovery, monitoring, and canary deployments. The session, rich with code demos, is available on YouTube, with code and slides on GitHub.
Microservices: Solving Business Problems
Arun Gupta opened by addressing the monolith vs. microservices debate, emphasizing that the choice depends on business needs. Microservices enable agility, frequent releases, and polyglot environments but introduce complexity. AWS simplifies this with managed services, allowing developers to focus on business logic. The demo application featured three microservices: a public-facing web app, and internal greeting and name services, communicating via REST endpoints. Built with WildFly Swarm, a Java EE-compliant server, the application produced a portable fat JAR, deployable as a container or Lambda function. The presenters highlighted service discovery, ensuring the web app could locate stateless instances of greeting and name services.
EC2: Full Control for Traditional Deployments
Amazon EC2 offers developers complete control over virtual machines, ideal for those needing to manage the full stack. The presenters deployed the microservices on EC2 instances, running WildFly Swarm JARs. Using Maven and a Docker profile, they generated container images, pushed to Docker Hub, and tested locally with Docker Compose. A docker stack deploy command spun up the services, accessible via curl localhost:8080, returning responses like “hello Sheldon.” EC2 requires manual scaling and cluster management, but its flexibility suits custom stacks. The GitHub repo includes configurations for EC2 deployments, showcasing integration with AWS services like CloudWatch for logging.
Amazon ECS: Orchestrating Containers
Amazon ECS simplifies container orchestration, managing scheduling and scaling. The presenters created an ECS cluster in the AWS Management Console, defining task definitions for the three microservices. Task definitions specified container images, CPU, and memory, with an Application Load Balancer (ALB) enabling path-based routing (e.g., /resources/greeting). Using the ECS CLI, they deployed services, ensuring high availability across multiple availability zones. CloudWatch integration provided metrics and logs, with alarms for monitoring. ECS reduces operational overhead compared to EC2, balancing control and automation. The session highlighted ECS’s deep integration with AWS services, streamlining production workloads.
AWS Fargate: Serverless Containers
Introduced at re:Invent 2017, AWS Fargate abstracts server management, allowing developers to focus on containers. The presenters deployed the same microservices using Fargate, specifying task definitions with AWS VPC networking for fine-grained security. The Fargate CLI, a GitHub project by AWS’s John Pignata, simplified setup, creating ALBs and task definitions automatically. A curl to the load balancer URL returned responses like “howdy Penny.” Fargate’s per-second billing and task-level resource allocation optimize costs. Available initially in US East (N. Virginia), Fargate suits developers prioritizing simplicity. The session emphasized its role in reducing infrastructure management.
Elastic Kubernetes Service (EKS): Kubernetes on AWS
EKS, in preview during the session, brings managed Kubernetes to AWS. The presenters deployed the microservices on an EKS cluster, using kubectl to manage pods and services. They introduced Istio, a service mesh, to handle traffic routing and observability. Istio’s sidecar containers enabled 50/50 traffic splits between “hello” and “howdy” versions of the greeting service, configured via YAML manifests. Chaos engineering was demonstrated by injecting 5-second delays in 10% of requests, testing resilience. AWS X-Ray, integrated via a daemon set, provided service maps and traces, identifying bottlenecks. EKS, later supporting Fargate, offers flexibility for Kubernetes users. The GitHub repo includes EKS manifests and Istio configurations.
AWS Lambda: Serverless Microservices
AWS Lambda enables serverless deployments, eliminating server management. The presenters repurposed the WildFly Swarm application for Lambda, using the Serverless Application Model (SAM). Each microservice became a Lambda function, fronted by API Gateway endpoints (e.g., /greeting). SAM templates defined functions, APIs, and DynamoDB tables, with sam local start-api testing endpoints locally via Dockerized Lambda runtimes. Responses like “howdy Sheldon” were verified with curl localhost:3000. SAM’s package and deploy commands uploaded functions to S3, while canary deployments shifted traffic (e.g., 10% to new versions) with CloudWatch alarms. Lambda’s per-second billing and 300-second execution limit suit event-driven workloads. The session showcased SAM’s integration with AWS services and the Serverless Application Repository.
Deployment Pipelines: Automating with AWS CodePipeline
The presenters built a deployment pipeline using AWS CodePipeline, a managed service inspired by Amazon’s internal tooling. A GitHub push triggered the pipeline, which used CodeCommit to build Docker images, pushed them to Amazon Elastic Container Registry (ECR), and deployed to an ECS cluster. For Lambda, SAM templates were packaged and deployed. CloudFormation templates automated resource creation, including VPCs, subnets, and ALBs. The pipeline ensured immutable deployments with commit-based image tags, maintaining production stability. The GitHub repo provides CloudFormation scripts, enabling reproducible environments. This approach minimizes manual intervention, supporting rapid iteration.
Monitoring and Logging: AWS X-Ray and CloudWatch
Monitoring was a key focus, with AWS X-Ray providing end-to-end tracing. In ECS and EKS, X-Ray daemons collected traces, generating service maps showing web app, greeting, and name interactions. For Lambda, X-Ray was enabled natively via SAM templates. CloudWatch offered metrics (e.g., CPU usage) and logs, with alarms for thresholds. In EKS, Kubernetes tools like Prometheus and Grafana were mentioned, but X-Ray’s integration with AWS services was emphasized. The presenters demonstrated debugging Lambda functions locally using SAM CLI and IntelliJ, enhancing developer agility. These tools ensure observability, critical for distributed microservices.
Choosing the Right Compute Option
The session concluded by comparing compute options. EC2 offers maximum control but requires managing scaling and updates. ECS balances automation and flexibility, ideal for containerized workloads. Fargate eliminates server management, suiting simple deployments. EKS caters to Kubernetes users, with Istio enhancing observability. Lambda, best for event-driven microservices, minimizes operational overhead but has execution limits. Factors like team expertise, application requirements, and cost influence the choice. The presenters encouraged feedback via GitHub issues to shape AWS’s roadmap. Visit aws.amazon.com/containers for more.
Links:
Hashtags: #AWS #Microservices #ECS #Fargate #EKS #Lambda #DevoxxFR2018 #ArunGupta #TiffanyJernigan #CloudComputing
[DevoxxFR2012] Java on Amazon Web Services: Building Scalable, Resilient Applications in the Cloud
Lecturer
Carlos Conde operates as a Solutions Architect within Amazon Web Services’ European team, where he partners with enterprises to design, migrate, and optimize Java applications on the AWS platform. His technical journey began over a decade ago when he founded IWorks, a company focused on Java web development atop legacy mainframe systems, followed by co-founding Newaxe, which delivered a Java-based ERP monitoring and management platform. After years as an independent consultant helping Fortune 500 companies modernize their stacks, Carlos joined AWS to bring cloud-native principles to the broader Java community. His expertise spans the full application lifecycle—from initial architecture through production operations—with a particular emphasis on cost optimization, high availability, and security.
Abstract
Carlos Conde provides an exhaustive guide to developing, deploying, and operating Java applications on Amazon Web Services, demonstrating how the platform’s breadth of services enables developers to build systems that are simultaneously scalable, resilient, and cost-effective. He introduces AWS Elastic Beanstalk as a fully managed Platform as a Service solution that abstracts infrastructure complexity, the AWS SDK for Java for programmatic service access, and the AWS Toolkit for Eclipse for seamless IDE integration. Through detailed live demonstrations and real-world case studies from companies like Viadeo and Netflix, Conde explores deployment strategies, database patterns, content delivery, monitoring, and disaster recovery. The presentation addresses hybrid cloud scenarios, data sovereignty requirements under European regulations, and advanced cost management techniques, concluding with a vision of serverless Java and containerized workloads that redefine operational excellence.
The AWS Java Ecosystem: Tools for Every Stage of Development
Carlos Conde opens by mapping the AWS service landscape to the Java developer’s workflow. At the foundation lies Amazon EC2, offering virtual servers with pre-built Java AMIs (Amazon Machine Images) that include OpenJDK, Tomcat, and Spring Boot. For developers seeking higher abstraction, AWS Elastic Beanstalk provides a PaaS experience where applications are deployed via simple commands:
eb init -p java-8 my-java-app
eb create production-env --instance_type t3.medium
eb deploy
Behind the scenes, Beanstalk provisions EC2 instances, Elastic Load Balancers, Auto Scaling groups, and CloudWatch alarms, while allowing full customization through .ebextensions configuration files. Conde demonstrates deploying a Spring Boot application that automatically scales from 2 to 10 instances based on CPU utilization, with zero-downtime blue/green deployments.
The AWS SDK for Java serves as the programmatic bridge to over 200 AWS services. Conde writes a service that stores user profiles in Amazon DynamoDB:
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
.withRegion(Regions.EU_WEST_3)
.build();
Map<String, AttributeValue> item = new HashMap<>();
item.put("userId", AttributeValue.builder().s(userId).build());
item.put("email", AttributeValue.builder().s(email).build());
item.put("createdAt", AttributeValue.builder().n(Long.toString(timestamp)).build());
PutItemRequest request = PutItemRequest.builder()
.tableName("Users")
.item(item)
.build();
client.putItem(request);
DynamoDB’s single-digit millisecond latency and automatic scaling make it ideal for high-throughput workloads. For relational data, Amazon RDS offers managed PostgreSQL, MySQL, or Oracle with automated backups, patching, and multi-AZ replication.
Content Delivery and Global Reach
For static assets, Conde integrates Amazon S3 with CloudFront:
AmazonS3 s3 = AmazonS3ClientBuilder.standard().build();
s3.putObject(PutObjectRequest.builder()
.bucket("my-app-assets")
.key("css/style.css")
.acl(ObjectCannedACL.PublicRead)
.build(), RequestBody.fromFile(Paths.get("style.css")));
CloudFront’s 200+ edge locations cache content close to users, reducing latency from 180ms to 30ms for European customers. He demonstrates invalidating cache after deployments using the AWS CLI.
Cost Optimization Strategies
Conde presents a multi-layered approach to cost control. Reserved Instances provide up to 75% savings for predictable workloads, while Savings Plans offer flexibility across EC2, Lambda, and Fargate. For batch processing, Spot Instances deliver 90% discounts:
RunInstancesRequest request = RunInstancesRequest.builder()
.instanceMarketOptions(InstanceMarketOptionsRequest.builder()
.marketType(MarketType.SPOT)
.spotOptions(SpotInstanceRequest.builder()
.spotPrice("0.10")
.instanceInterruptionBehavior(InstanceInterruptionBehavior.TERMINATE)
.build())
.build())
.build();
He uses AWS Cost Explorer to visualize spending and set budget alerts.
High Availability and Disaster Recovery
Conde designs a multi-AZ architecture with RDS read replicas, ElastiCache for Redis caching, and S3 cross-region replication. He demonstrates failover using Route 53 health checks that automatically reroute traffic if a region fails.
Security and Compliance
Security is baked into every layer. AWS Identity and Access Management (IAM) enforces least-privilege access, while AWS KMS manages encryption keys. Conde enables S3 server-side encryption and RDS TDE (Transparent Data Encryption) with a single click.
Hybrid and Sovereign Cloud Deployments
For European data residency, Conde deploys entirely within the Paris region (eu-west-3). For hybrid scenarios, AWS Direct Connect establishes dedicated network connections to on-premises data centers, and AWS Outposts brings AWS services into private facilities.
Monitoring, Logging, and Observability
Amazon CloudWatch collects metrics, logs, and events. Conde instruments a Spring Boot application with Micrometer:
@Timed(value = "order.processing.time", description = "Time taken to process order")
public Order processOrder(OrderRequest request) {
// Business logic
}
AWS X-Ray traces requests across services, identifying latency bottlenecks.
Real-World Case Studies
Conde shares Viadeo’s migration of their social platform to AWS, achieving 99.99% availability and reducing infrastructure costs by 60%. Netflix’s global streaming architecture leverages AWS for transcoding, personalization, and content delivery at petabyte scale.
The Future of Java on AWS
Conde previews AWS Lambda for serverless Java, AWS Fargate for containerized workloads without server management, and AWS Graviton2 processors offering 40% better price-performance for Java applications.
Implications for Java Enterprises
Carlos Conde concludes that AWS transforms Java development from infrastructure-constrained to innovation-focused. By leveraging managed services, developers build faster, operate more reliably, and scale globally—all while maintaining strict control over costs and compliance.