Giter Club home page Giter Club logo

aws-mock-metadata's People

Contributors

cpuid avatar jtblin avatar moserke avatar mumoshu avatar vincer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-mock-metadata's Issues

Enhancement - support some of the new IMDS fields

AWS recently added new fields, most notably region:
region, placement group name, partition number, host ID, and availability zone-ID:

https://aws.amazon.com/about-aws/whats-new/2020/08/amazon-ec2-instance-metadata-service-supports-additional-fields-improved-automation-operability/

I could create a PR.

placement/group-name
placement/host-id
placement/partition-number
placement/region
placement/availability-zone-id

Sample values:

placement/region: us-west-2
placement/availability-zone-id: usw2-az1

More detailed example

Hi I'd really like to run an EC2 metadata mock/spoof server in docker to test an EC2 library I have using compose. I've tried the docker run -it ... command you provided as well as building with go but to no avail. Is there any chance you could provide a more detailed example using either compose or just docker to run this?

Create package

I think it make sense to make this as a package, so we can use it as a mock for unit testing in kube2iam. What do you think?

Ability to mock spot termination

Sometimes it is nice to be able to mock that an instance has been set for spot termination. This is indicated by the spot/termination-time key existing

error msg="Not found info"

How would I go about debugging:

time="2018-10-14T07:33:42Z" level=info msg="Requesting /latest/meta-data/instance-id"
time="2018-10-14T07:33:42Z" level=info msg="Requesting /latest/meta-data/iam/info"
time="2018-10-14T07:33:42Z" level=error msg="Not found info"

running in minikube with:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: aws-mock
  labels:
    app: aws-mock
spec:
  selector:
    matchLabels:
      app: aws-mock
  template:
    metadata:
      name: aws-mock
      labels:
        app: aws-mock
    spec:
      containers:
      - image: jtblin/aws-mock-metadata
        imagePullPolicy: Always
        name: aws-mock
        ports:
        - containerPort: 80
          protocol: TCP
        env:
        - name: AVAILABILITY_ZONE
          value: "us-west-2"
        - name: AWS_ACCESS_KEY_ID
          valueFrom:
            secretKeyRef:
              name: aws-creds
              key: AWS_ACCESS_KEY_ID
        - name: AWS_SECRET_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: aws-creds
              key: AWS_SECRET_ACCESS_KEY
        - name: AWS_SESSION_TOKEN
          valueFrom:
            secretKeyRef:
              name: aws-creds
              key: AWS_SESSION_TOKEN
        - name: AWS_SDK_LOAD_CONFIG
          value: "1"
        args:
          - "--availability-zone=us-west-2"
          - "--instance-id=i-0a148cec064fc841c"
          - "--app-port=80"
          - "--private-ip=172.28.159.34"

`Server: EC2ws` response header is missing

Hi, thanks for sharing this project :)

When I run curl --dump-header 169.254.169.254 on "actual" EC2 instances, I get:

$ curl --dump-header - http://169.254.169.254
HTTP/1.0 200 OK
Content-Type: text/plain
Accept-Ranges: bytes
ETag: "83579665"
Last-Modified: Thu, 19 May 2016 08:21:00 GMT
Content-Length: 153
Connection: close
Date: Fri, 27 May 2016 06:36:38 GMT
Server: EC2ws

*snip*

which includes the Server: EC2ws header.
Running the same curl command against aws-mock-metadata doesn't return it.

It may be a problem when you tried to use aws-mock-metadata to test applications that expect metadata service to return that header.
An example of such application is fluentd-plugin-google-cloud which relies on it to determine where it is running on(EC2 or GCE).

https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/blob/b1db6ef/lib/fluent/plugin/out_google_cloud.rb#L507

This project is unlicensed

I would like to use/fork/contribute to this project but it is currently unlicensed, which in most countries means that the license is a default "all rights reserved" copyright (preventing anyone from using your code).

Please see github documentation/recommendations and choose a license:

https://help.github.com/articles/open-source-licensing/
http://choosealicense.com/

My personal favorites these days are the MIT (same as the python implementation that inspired this project) or Modified BSD licenses.

Test Coverage

Hey @jtblin

I currently have a fork at https://github.com/CpuID/aws-mock-metadata with about 80~% test coverage over the entire EC2 Metadata API (including redirects, endpoint listings, etc), which is close to all passing but still needs some minor work.

Would you be interested in adding me as a maintainer to the project? Happy to PR my changes back here in the process also. Or would you prefer me to maintain an independent fork?

Thanks.

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.