Skip to content

Instantly share code, notes, and snippets.

@kvaps
Created June 3, 2020 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvaps/9bf90c62be46c847d4f68b22b747c477 to your computer and use it in GitHub Desktop.
Save kvaps/9bf90c62be46c847d4f68b22b747c477 to your computer and use it in GitHub Desktop.
spec:
hostNetwork: true
initContainers:
- name: eip
image: docker.io/amazon/aws-cli:2.0.18
command:
- /bin/bash
- -xec
- |
INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
aws ec2 disassociate-address --public-ip "$PUBLIC_IP" || true
aws ec2 associate-address --public-ip "$PUBLIC_IP" --instance-id "$INSTANCE_ID"
env:
- name: PUBLIC_IP
value:
- name: AWS_REGION
value: eu-central-1
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: awsKeyId
name: restund
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: awsSecretKey
name: restund
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment