全,
我试图在法尔盖特上的AWS ECS计划任务上实现云托管解决方案。
我的Dockerfile看起来像:
FROM cloudcustodian/c7n:latest
WORKDIR /opt/src
COPY policy.yml policy.yml
COPY mailer.yml mailer.yml
ENTRYPOINT [ "/bin/sh" ]policy.yml看上去就像
policies:
- name: c7n-mailer-test
resource: sqs
filters:
- "tag:MailerTest": absent
actions:
- type: notify
template: default
priority_header: '2'
subject: testing the c7n mailer
to:
- test@mydomain.com
transport:
type: sqs
queue: arn:aws:iam::xxxx:role/cloud-custodian-mailer-role-svc另外,mailer.yml看起来像
queue_url: https://sqs.ap-southeast-1.amazonaws.com/xvxvxvx9/cloud-custodian
role: arn:aws:iam::xxxxx:role/cloud-custodian-mailer-role
from_address: test@mydomain.in运行映像后,我无法在SQS或收件人的电子邮件中看到任何消息。
另外,我还如何将输出存储在s3上。
发布于 2020-02-09 12:52:39
在码头枢纽云保管人上已经有一个正式的码头映像:https://hub.docker.com/r/cloudcustodian/c7n。
如果您想使用与托管人一起使用的工具,那么码头集线器Ex上也有单独的码头映像。梅勒:https://hub.docker.com/r/cloudcustodian/mailer
但是,如果您想在同一个容器中同时运行,请查看以下内容:https://github.com/harsh4870/cloud-custodian
Dockerfile
FROM python:3.6-alpine
LABEL MAINTAINER="Harsh Manvar <harsh.manvar111@gmail.com>"
WORKDIR /opt/src
COPY cloud-custodian .
RUN apk add --no-cache --virtual .build-deps gcc musl-dev
RUN pip install -r requirements.txt && \
python setup.py install && \
cd tools/c7n_mailer/ && \
pip install -r requirements.txt && \
pip install requests && \
python setup.py install
RUN apk del .build-deps gcc musl-dev
WORKDIR /opt/src
COPY policy.yml policy.yml
COPY mailer.yml mailer.yml
ENTRYPOINT [ "/bin/sh" ]通过传递命令来运行码头映像:
docker run \
-e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
-e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
-e AWS_DEFAULT_REGION="$(REGION)" \
-v "$(CURDIR)/logs:/tmp" \
"cloud-custodian:$(VERSION)" \
-c "/usr/local/bin/custodian run -c policy.yml -s .; /usr/local/bin/c7n-mailer --config mailer.yml --run"https://stackoverflow.com/questions/60104043
复制相似问题