Giter VIP home page Giter VIP logo

crossplane-ec2-provisioning's Introduction

Crossplane EC2 Provisioning

This project demonstrates how to provision EC2 instances on AWS using Crossplane.

Overview

The project consists of several components:

  • CompositeResourceDefinition (CRD): Defines the custom resource EC2 that users can create to request EC2 instances with specific configurations.
  • Composition: Describes how to compose the EC2 custom resource with the necessary patches to provision EC2 instances on AWS.
  • Provider Configuration: Configures the AWS provider in Crossplane and sets up secrets for AWS credentials.
  • Initialization Script: Bash script (init.sh) for installing Crossplane and the AWS provider, as well as setting up required configurations.
  • Example EC2 Resource: An example EC2 custom resource (ec2-light.yaml) showcasing how to request an EC2 instance with default parameters.

Prerequisites

Before running the initialization script, ensure the following:

  • File aws-credentials.txt is filled with the right AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  • KUBECONFIG environment variable is set.
  • kubectl and helm are installed.

Getting Started

To set up Crossplane and provision EC2 instances on AWS, follow these steps:

  1. Clone this repository.
  2. Set the required environment variables.
  3. Run the initialization script: ./init.sh.

Usage

Run the following command to install the CRD (CompositeResourceDefinition), and the composition:

kubectl apply -f CompositeResourceDefinitions/ec2_definition.yaml
kubectl apply -f Compositions/ec2_composition.yaml

Once the initialization is complete, you can create EC2 instances by applying the EC2 custom resource YAML files. For example:

apiVersion: omerap12.com/v1alpha1
kind: EC2
metadata:
  name: ec2-light # Resource name
  annotations:
    creator: crossplane
    author: omerap12
spec:
  compositionSelector:
    matchLabels:
      provider: aws
  parameters:
    ec2type: cheap # cheap/memory/cpu/gpu/storage optimized (default cheap)
    operatingSystem: linux # linux(AL),Windows, Ubuntu (default AL2)
    subnetId: xxx # Must specify subnet id 
    publicIp: false # true/false (deafult false)

A new instance will be created and be managed by crossplane.

Mapping

ec2type

  • cheap: t2.micro
  • memory: r5.large
  • cpu: c5.large
  • gpu: p3.xlarge
  • storage: i3.large

operatingSystem

  • linux: ami-0c101f26f147fa7fd
  • windows: ami-03cd80cfebcbb4481
  • ubuntu: ami-080e1f13689e07408

crossplane-ec2-provisioning's People

Contributors

omerap12 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.