Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 2.33 KB

README.adoc

File metadata and controls

78 lines (53 loc) · 2.33 KB

The Pizza Hat demo

First, create the bucket that we will use in the demo:

oc apply -k ocp-odf/pizza-hat

You just need to retrieve the credentials to the bucket and point to the bucket route url:

BUCKET_NAME=menu
OBC_NS=pizza-hat
export AWS_ACCESS_KEY_ID=$(oc get secret $BUCKET_NAME -n $OBC_NS -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' | base64 --decode)
export AWS_SECRET_ACCESS_KEY=$(oc get secret $BUCKET_NAME -n $OBC_NS -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' | base64 --decode)
export BUCKET_HOST=$(oc get route s3-rgw -n openshift-storage --template='{{ .spec.host }}')
export BUCKET_PORT=$(oc get configmap $BUCKET_NAME -n $OBC_NS -o jsonpath='{.data.BUCKET_PORT}')

Check content of the bucket:

aws s3 ls s3://${BUCKET_NAME}/ --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT

Push the content of the menu:

aws s3 cp ocp-odf/pizza-hat/red-hat-pizza-menu-v1.pdf s3://${BUCKET_NAME}/ --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT
aws s3 cp ocp-odf/pizza-hat/red-hat-pizza-menu-v2.pdf s3://${BUCKET_NAME}/ --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT

Access the menu URL:

oc get route s3-rgw -n openshift-storage --template="http://{{ .spec.host }}/${BUCKET_NAME}/red-hat-pizza-menu-v1.pdf"
# https://s3-rgw-openshift-storage.apps.ocp.sandbox922.opentlc.com/menu/red-hat-pizza-menu-v2.pdf

Provide view access to people with the link:

aws s3api put-object-acl --bucket ${BUCKET_NAME} --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT --key red-hat-pizza-menu-v1.pdf --acl public-read
aws s3api put-object-acl --bucket ${BUCKET_NAME} --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT --key red-hat-pizza-menu-v2.pdf --acl public-read

Check permissions of the object in bucket:

aws s3api get-object-acl --bucket ${BUCKET_NAME} --endpoint-url http://$BUCKET_HOST:$BUCKET_PORT --key red-hat-pizza-menu-v1.pdf

AWS S3 Bucket

BUCKET_NAME=alvaro-menu
aws s3 ls s3://$BUCKET_NAME/
aws s3 cp ocp-odf/pizza-hat/red-hat-pizza-menu-v1.pdf s3://${BUCKET_NAME}/

aws s3api put-object-acl --bucket $BUCKET_NAME --key red-hat-pizza-menu-v1.pdf --acl public-read # I don't have enough permissions

aws s3 presign s3://$BUCKET_NAME/red-hat-pizza-menu-v1.pdf --expires-in 86400