diff --git a/infra/aws-s3/Readme.md b/infra/aws-s3/Readme.md new file mode 100644 index 000000000..8d63e2d8a --- /dev/null +++ b/infra/aws-s3/Readme.md @@ -0,0 +1,52 @@ +# Apache Camel Kamelets - AWS S3 Commodity Configuration files + +In this directory you'll find: + +- Ansible +- Terraform +- Cloudformation + +Configuration files, to be used for creating your infra for using AWS S3 Kamelets. + +This will create an S3 Bucket with basic functionalities. + +## Ansible + +The commmand to create the infra is: + +```bash +$ ansible-playbook -v ansible/aws-s3.yaml --extra-vars bucket_name= +``` + +## Terraform + +The commmand to create the infra is: + +```bash +$ cd terraform/ +$ terraform init +$ terraform apply -var="bucket_name=" +``` + +Once completed do: + +```bash +$ cd terraform/ +$ terraform destroy +``` + +## Cloudformation + +The commmand to create the infra is: + +```bash +$ aws cloudformation deploy --template-file cloudformation/aws-s3.yaml --stack-name my-new-stack --parameter-overrides BucketName= +``` + +Once completed do: + +```bash +$ aws cloudformation delete-stack --stack-name my-new-stack +``` + + diff --git a/infra/aws-s3/ansible/aws-s3.yaml b/infra/aws-s3/ansible/aws-s3.yaml new file mode 100644 index 000000000..2700147e6 --- /dev/null +++ b/infra/aws-s3/ansible/aws-s3.yaml @@ -0,0 +1,12 @@ +--- +- name: Create AWS S3 Bucket + hosts: localhost + vars: + encryption_type: "AES256" + tasks: + - name: Create bucket without JSON policy + amazon.aws.s3_bucket: + name: "{{ bucket_name }}" + state: present + encryption: "{{ encryption_type }}" + register: created_bucket diff --git a/infra/aws-s3/cloudformation/aws-s3.yaml b/infra/aws-s3/cloudformation/aws-s3.yaml new file mode 100644 index 000000000..cc1cda135 --- /dev/null +++ b/infra/aws-s3/cloudformation/aws-s3.yaml @@ -0,0 +1,12 @@ +Parameters: + BucketName: + Type: String + Description: The bucket name. + +Resources: + S3Bucket: + Type: 'AWS::S3::Bucket' + DeletionPolicy: Retain + Properties: + BucketName: + Ref: BucketName diff --git a/infra/aws-s3/terraform/main.tf b/infra/aws-s3/terraform/main.tf new file mode 100644 index 000000000..9068e175b --- /dev/null +++ b/infra/aws-s3/terraform/main.tf @@ -0,0 +1,7 @@ +variable "bucket_name" { + type = string +} + +resource "aws_s3_bucket" "example" { + bucket = var.bucket_name +}