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:
<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:
Notes about the Jar plugin:
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':
<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:
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