-
Notifications
You must be signed in to change notification settings - Fork 13
Deploying Applications to AWS
There are many ways to deploy AWS applications. On this guide we will talk about S3 and Code Deploy and how we would be able to use both of them to automate your deployment routine.
Before you go further, ensure you have your IAM credentials properly configured on your application and EC2 instances.
You can easily send your project artifact to a S3 bucket. Here are the steps you need to do:
-
Create a S3 Bucket. On this guide, we will assume you have named your bucket as 'deployment-bucket'.
-
Create an IAM Policy (or update an already created one) and make sure that grants the following actions:
"s3:PutObject"
- Copy and paste the following properties on you project definition file (pom.xml).
<config.plugins.aws.s3.enabled>true</config.plugins.aws.s3.enabled>
<config.plugins.aws.s3.region>us-east-1</config.plugins.aws.s3.region>
<config.plugins.aws.s3.bucket>deployment-bucket</config.plugins.aws.s3.bucket>
<config.plugins.jar.enabled>true</config.plugins.jar.enabled>
Notes about S3 plugin:
- config.plugins.aws.s3.enabled: it turns on the S3 deployment plugin
- config.plugins.aws.s3.region: is region your bucket is actually placed
- config.plugins.aws.s3.bucket: the bucket name the plugin should send the artifact
Notes about the Jar plugin:
- config.plugins.jar.enabled: if true, will generate a runnable jar from your project.
- Run 'kikaha deploy' or 'mvn clean deploy' in order to send your just generated artifact to the S3 bucket.
Although we can easily deploy anything to S3, you probably will notice there is a lot more to do in order to ensure your application is up and running right after you deploy it to an S3 bucket. The best to get it done easily is CodeDeploy. So, lets take a see how we can setup a Kikaha project to deploy applications with CodeDeploy.
-
Follow the guide above and configure your project to deploy on S3. AWS CodeDeploy can retrieve artifacts from S3 buckets and deploy them on your EC2 instances.
-
Follow only the two following steps from this AWS CodeDeploy Guide. We will assume you created an Application Deployment named 'microservice1.example.com' and a deployment group named 'production':
- Configure your instances: it covers how to make your instances ready to receive a deployable artifact and start it once a deployment is ready to be deployed.
- Creating Your Application and Deployment Groups.
-
Once you've configured the S3 deployment, include the following properties on your pom.xml file.
<config.plugins.aws.s3.useCodeDeploy>true</config.plugins.aws.s3.useCodeDeploy>
<config.plugins.aws.s3.codeDeployApplicationName>microservice1.example.com</config.plugins.aws.s3.codeDeployApplicationName>
<config.plugins.aws.s3.codeDeployDeploymentGroupName>production</config.plugins.aws.s3.codeDeployDeploymentGroupName>
Notes about the CodeDeploy plugin:
- config.plugins.aws.s3.useCodeDeploy: if true, will notify your Application Deployment that a new revision is ready
- config.plugins.aws.s3.codeDeployApplicationName: the Application Deployment
- config.plugins.aws.s3.codeDeployDeploymentGroupName: the deployment group you defined for this app
- If everything went right, you should be able to run 'kikaha deploy' or 'mvn clean deploy' and see your EC2 instances being automatically updated.
WELCOME
About
Kikaha philosophy
GETTING STARTED
Getting started in 1 minute
Creating a Kikaha maven project
Architecture overview
TUTORIALS
Logging configuration
Configuring the server
Creating your first HTTP route
Kikaha's command line interface
Configuring your favorite IDE
Wro4j Integration
CircleCI Integration
CORE FEATURES
HTTP and HTTPS
Routing static assets
Dependency injection
Authentication and authorization
Smart routes
ESSENTIAL MODULES
μRouting API
WebSocket Routing
Database Connection Pool
JSON with Jackson
Protobuf
Mustache Templates
Rocker Templates
BCrypt
CLOUD MODULES
Overview of Cloud Modules
Consul.io
Codahale's Metrics
Auth0 Single Sign-On
μWorkers - Actor-like API
Hazelcast
AWS-RELATED MODULES
Overview of AWS-Related Modules
Deploying Applications on AWS
AWS IAM Credentials
AWS EC2
AWS SQS queues
AWS CloudWatch metrics
AWS Application Load Balancer
AWS Lambda functions
AWS X-Ray
ADVANCED TOPICS
Creating custom modules
Routing with Undertow's API
Creating custom cloud modules