Download as pdf or txt
Download as pdf or txt
You are on page 1of 74

Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

S105665GC20
Activity Guide
Fi
kr
em
ar

Foundations
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa

Learn more from Oracle University at education.oracle.com


us @
e er
th a.
is go
Gu v.

Oracle Cloud Infrastructure


ide et)
. has
a
Copyright © 2023, Oracle and/or its affiliates.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Disclaimer

This document contains proprietary information and is protected by copyright and other intellectual property
laws. The document may not be modified or altered in any way. Except where your use constitutes "fair use"
under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce,
publish, license, post, transmit, or distribute this document in whole or in part without the express authorization
of Oracle.

The information contained in this document is subject to change without notice and is not warranted to be
error-free. If you find any errors, please report them to us in writing.

Restricted Rights Notice

a
If this documentation is delivered to the United States Government or anyone using the documentation on

. has
behalf of the United States Government, the following notice is applicable:

ide et)
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any
programs embedded, installed or activated on delivered hardware, and modifications of such programs) and

Gu v.
Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are

is go
"commercial computer software" or "commercial computer software documentation" pursuant to the applicable
Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction,

th a.
duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i)

e er
Oracle programs (including any operating system, integrated software, any programs embedded, installed or

us @
activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation
and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the
to bsa
applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the
applicable contract for such services. No other rights are granted to the U.S. Government.
se .o
en m

Trademark Notice
lic aria

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
ble m
ra re

Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the
fe (fik

AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark
of The Open Group.
ns a
tra bs

Third-Party Content, Products, and Services Disclaimer


n- O

This documentation may provide access to or information about content, products, and services from third
no iam

parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any
kind with respect to third-party content, products, and services unless otherwise set forth in an applicable
ar

agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss,
em

costs, or damages incurred due to your access to or use of third-party content, products, or services, except as
set forth in an applicable agreement between you and Oracle.
kr
Fi

2005182023
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Table of Contents

Identity and Access Management (IAM): Create IAM Components - With Identity Domains Enabled
........................................................................................................................................................... 5
Get Started ..................................................................................................................................... 6
Create a Compartment (With Identity Domains Enabled) .............................................................. 8

a
Create a User (With Identity Domains Enabled) ............................................................................ 9

. has
Create a Group, and Add a User to the Group (With Identity Domains Enabled) ......................... 10
Create a Policy (With Identity Domains Enabled) .......................................................................... 11

ide et)
Create a Dynamic Group (With Identity Domains Enabled) ........................................................... 12

Gu v.
Identity and Access Management (IAM): Create IAM Components - Without Identity Domains

is go
Enabled ............................................................................................................................................. 13

th a.
Get Started ..................................................................................................................................... 14

e er
Create a Compartment (Without Identity Domains Enabled) ......................................................... 16

us @
Create a User (Without Identity Domains Enabled) ....................................................................... 17
to bsa
Create a Group, and Add a User to the Group (Without Identity Domains Enabled) .................... 18
se .o

Create a Policy (Without Identity Domains Enabled) ..................................................................... 19


en m

Create a Dynamic Group (Without Identity Domains Enabled) ...................................................... 20


lic aria

Networking—Virtual Cloud Network: Create and Configure a Virtual Cloud Network ............. 21
ble m

Get Started ..................................................................................................................................... 22


ra re

Create a Virtual Cloud Network ...................................................................................................... 24


fe (fik

Networking: OCI Load Balancer ..................................................................................................... 27


ns a

Get Started ..................................................................................................................................... 28


tra bs

Create a Virtual Cloud Network ...................................................................................................... 30


n- O

Create Two Compute Instances (Backend Servers) ...................................................................... 31


no iam

Create a Load Balancer.................................................................................................................. 34


ar

Compute: Create a Web Server on an OCI Compute Instance .................................................... 37


em

Get Started ..................................................................................................................................... 38


Launch Cloud Shell ........................................................................................................................ 39
kr
Fi

Generate SSH Keys ....................................................................................................................... 40


Create a Virtual Cloud Network and Its Components .................................................................... 42
Create a Compute Instance ........................................................................................................... 45
Install an Apache HTTP Server on the Instance ............................................................................ 47
Object Storage: Create and Manage OCI Object Storage ............................................................ 49
Get Started ..................................................................................................................................... 50
Create an Object Storage Bucket ................................................................................................... 51
Upload an Object to a Bucket ......................................................................................................... 53

Copyright © 2023, Oracle and/or its affiliates.

Oracle Cloud Infrastructure Foundations – Table of Contents iii


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Block Storage: Create, and Attach a Block Volume ..................................................................... 55


Get Started ..................................................................................................................................... 56
Create a Virtual Cloud Network and Its Components .................................................................... 58
Create a VM Instance ..................................................................................................................... 60
Create a Block Volume ................................................................................................................... 63
Attach a Block Volume to a Compute Instance .............................................................................. 64
Security: Configure Security Zones Using Maximum Security Zones ....................................... 67
Get Started ..................................................................................................................................... 68

a
Set Up Security Zone with Maximum Security Recipe ................................................................... 70

. has
View the Security Zone Policies Attached with a Created Security Zone ...................................... 71
Verify Creating a Bucket in an Assigned Compartment Using a Oracle-Managed Key ................ 72

ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

iv Oracle Cloud Infrastructure Foundations – Table of Contents


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er
th a.
Lab 1-1 Practices
is go
Gu v.
ide et)
. has
a
Identity and Access

IAM Components - With


Identity Domains Enabled
Management (IAM): Create
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

Oracle Cloud Infrastructure (OCI) Identity and Access Management (IAM) lets you control who
has access to your cloud resources.

In this lab, we will help you create a compartment, group, user, and policy. We will also provide
the steps to create a dynamic group.

a
. has
Note: Below instructions are for accounts with Identity Domains enabled.

ide et)
In this lab, you’ll:

Gu v.
is go
a. Create a compartment

th a.
e er
b. Create a user

us @
c. Create a group, and add a user to the group
to bsa
se .o

d. Create a policy
en m
lic aria

e. Create a dynamic group


ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

6 Identity and Access Management: Create IAM Components - With Identity Domains Enabled
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go

Identity and Access Management: Create IAM Components - With Identity Domains Enabled
Gu v.
ide et)
. has
a

7
Create a Compartment (With Identity Domains Enabled)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

A compartment is a collection of related resources. Compartments are fundamental


components of OCI and are used for organizing and isolating your cloud resources.

In this practice, you will learn how to create a compartment.

Tasks

a
1. Sign in to the OCI Console.

. has
2. Open the Main Menu and select Identity & Security. Under Identity,

ide et)
click Compartments. A list of the compartments to which you have access appears.

Gu v.
is go
3. Click Create Compartment.

th a.
Do the following:

e er
4.

us @
a. Name: Enter a unique name for the compartment. The name must be unique across
to bsa
all the compartments in your tenancy.
se .o
en m

b. Description: Enter a compartment-related description.


lic aria

c. Parent Compartment: The compartment you are in appears by default.


ble m
ra re

5. Click Create Compartment. The Child Compartment now appears in the list of
fe (fik

compartments.
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

8 Identity and Access Management: Create IAM Components - With Identity Domains Enabled
Create a User (With Identity Domains Enabled)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

A user is an individual employee or system that needs to manage or use your


company’s OCI resources.

In this practice, you’ll learn how to create a user.

Tasks

a
1. Open the Main Menu and select Identity & Security. Under Identity, click Domains. A

. has
list of domains in your tenancy appears.

ide et)
2. Select the Domain that is allotted to you. Otherwise, you can click on the Default domain.

Gu v.
is go
3. Under Identity domain, click Users. A list of the users in your domain appears.

th a.
Click Create User.

e er
4.

us @
5. Enter the following: to bsa
a. First Name: Enter first name of user.
se .o
en m
lic aria

b. Last Name: Enter last name of user.


ble m

c. Username/Email: Enter an email address for the user.


ra re
fe (fik

d. Check the Use the same email address as the username. Do not select the
Assign cloud account administrator role check box.
ns a
tra bs

Click Create. The user now appears in the list of users.


n- O

6.
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Identity and Access Management: Create IAM Components - With Identity Domains Enabled 9
Create a Group, and Add a User to the Group (With
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Identity Domains Enabled)


A group is a collection of users who need the same type of access to a particular compartment
or set of resources.

In this practice, you’ll learn how to create a group, and add a user to a group.

Tasks

a
. has
1. Open the Main Menu and select Identity & Security. Under Identity, click Domains. A
list of domains in your tenancy appears.

ide et)
Gu v.
2. Click on the Default domain.

is go
th a.
3. Under Identity domain, click Groups. A list of the groups in your domain appears.

e er
us @
4. Select the Administrators group.
to bsa
5. Click Assign User to Groups.
se .o
en m

6. Select the user created earlier from the Users drop-down list, and then click Add. The user
lic aria

now appears in the group.


ble m

7. Use the breadcrumb trail to go back to the Groups page and click Create Group.
ra re
fe (fik

8. Enter the following:


ns a

a. Name: Enter a unique name for the group.


tra bs
n- O

b. Description: Enter a group-related description.


no iam

9. Click Create. The group now appears in the list of groups.


ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

10 Identity and Access Management: Create IAM Components - With Identity Domains Enabled
Create a Policy (With Identity Domains Enabled)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

A policy is a document that specifies who can access which resources, and how.

In this practice, you’ll learn how to create a policy.

Tasks

1. Open the Main Menu and select Identity & Security. Under Identity, click Policies.

a
Click Create Policy.

. has
2.

Enter the following:

ide et)
3.

Gu v.
a. Name: Enter a unique name for the policy.

is go
th a.
b. Description: Enter a policy-related description.

e er
us @
c. Compartment: If you want to attach the policy to a compartment other than the one
to bsa
you’re viewing, select it from the drop-down list. Remember, where the policy is
attached controls who can later modify or delete it.
se .o
en m
lic aria

4. In the Policy Builder section, click Show manual editor and enter the policy statement.
ble m

Note: A sample statement would look like the following:


ra re
fe (fik

allow group <group_name> to manage virtual-network-family in


compartment <compartment_name>
ns a
tra bs

5. Click Create. The policy now appears in the list of policies.


n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Identity and Access Management: Create IAM Components - With Identity Domains Enabled 11
Create a Dynamic Group (With Identity Domains
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Enabled)
A dynamic group is a special type of group that contains resources, such as compute
instances, which match rules that you define. This means that group membership can change
dynamically as matching resources are created or deleted. These instances serve as “principal”
actors and can make API calls to services according to policies that you write for the dynamic
group.

a
In this practice, you’ll learn how to create a dynamic group.

. has
Tasks

ide et)
Gu v.
Open the Main Menu and select Identity & Security. Under Identity, click Domains. A

is go
1.
list of domains in your tenancy appears.

th a.
e er
Click on the Default domain.

us @
2.
to bsa
3. Under Identity domain, click Dynamic Groups.
se .o

4. Click Create Dynamic Group.


en m
lic aria

5. Enter the following:


ble m

a. Name: Enter a unique name for the group. The name must be unique across all groups
ra re

in your tenancy, including dynamic groups and user groups.


fe (fik

b. Description: Enter a friendly description.


ns a
tra bs

6. Enter the Matching Rules. Resources that meet the rule criteria are members of the
n- O

dynamic group.
no iam

a. Rule 1: Enter a rule by following the guidelines in https://docs.oracle.com/en-


ar

us/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#Writing
em

https://docs.oracle.com/en-
us/iaas/Content/Identity/Tasks/managingdynamicgroups.htm.
kr
Fi

Note: You can manually enter the rule in the text box or launch the rule builder.

− For example, to include all instances that are in a specific compartment, add a rule
with the following syntax:
instance.compartment.id = '<compartment_ocid>'

b. Enter additional rules as needed. To add a rule, click +Additional Rule.

7. Click Create. The dynamic group now appears in the list of dynamic groups.

Copyright © 2023, Oracle and/or its affiliates.

12 Identity and Access Management: Create IAM Components - With Identity Domains Enabled
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er
th a.
Lab 1-2 Practices
is go
Gu v.
ide et)
. has
a
Identity and Access

Identity Domains Enabled


Management (IAM): Create
IAM Components - Without
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

Oracle Cloud Infrastructure (OCI) Identity and Access Management (IAM) lets you control who
has access to your cloud resources.

In this lab, we will help you create a compartment, group, user, and policy. We will also provide
the steps to create a dynamic group.

a
. has
Note: Below instructions are for accounts without Identity Domains enabled.

ide et)
In this lab, you’ll:

Gu v.
is go
a. Create a compartment

th a.
e er
b. Create a user

us @
c. Create a group, and add a user to the group
to bsa
se .o

d. Create a policy
en m
lic aria

e. Create a dynamic group


ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

14 Identity and Access Management: Create IAM Components - Without Identity Domains Enabled
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go

Identity and Access Management: Create IAM Components - Without Identity Domains Enabled
Gu v.
ide et)
. has
a

15
Create a Compartment (Without Identity Domains
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Enabled)
A compartment is a collection of related resources. Compartments are fundamental
components of OCI and are used for organizing and isolating your cloud resources.

In this practice, you will learn how to create a compartment.

Tasks

a
. has
1. Sign in to the OCI Console.

ide et)
2. Open the Main Menu and select Identity & Security. Under Identity,

Gu v.
click Compartments. A list of the compartments to which you have access appears.

is go
Under Child Compartment, click Create Compartment.

th a.
3.

e er
4. Do the following:

us @
a.
to bsa
Name: Enter a unique name for the compartment. The name must be unique across
all the compartments in your tenancy.
se .o
en m
lic aria

b. Description: Enter a compartment-related description.


ble m

c. Parent Compartment: The compartment you are in appears by default. To choose


ra re

another compartment in which to create this compartment, select from the drop-
fe (fik

down list.
ns a

Click Create Compartment. The Child Compartment now appears in the list of
tra bs

5.
compartments.
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

16 Identity and Access Management: Create IAM Components - Without Identity Domains Enabled
Create a User (Without Identity Domains Enabled)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

A user is an individual employee or system that needs to manage or use your


company’s OCI resources.

In this practice, you’ll learn how to create a user.

Tasks

a
1. Open the Main Menu and select Identity & Security. Under Identity, click Users. A list of

. has
users in your tenancy appears.

ide et)
2. Click Create User.

Gu v.
is go
3. Enter the following:

th a.
a. Name: Enter a unique name or email address for the user.

e er
us @
b. Description: This value could be the user’s full name, a nickname, or any other
to bsa
descriptive information.
se .o
en m

c. Email: Enter an email address for the user. This email address is used for
lic aria

password recovery.
ble m

4. Click Create. The user now appears in the list of users.


ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Identity and Access Management: Create IAM Components - Without Identity Domains Enabled 17
Create a Group, and Add a User to the Group (Without
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Identity Domains Enabled)


A group is a collection of users who need the same type of access to a particular compartment
or set of resources.

In this practice, you’ll learn how to create a group, and add a user to a group.

Tasks

a
. has
1. Open the Main Menu and select Identity & Security. Under Identity, click Groups. A list
of the groups in your tenancy appears.

ide et)
Gu v.
2. Click on the Administrators group.

is go
th a.
3. Click Add User to Group.

e er
us @
4. Select the user created earlier from the Users drop-down list, and then click Add. The user
now appears in the group.
to bsa
se .o

5. Use the breadcrumb trail to go back to the Groups page and click Create Group.
en m
lic aria

6. Enter the following:


ble m

a. Name: Enter a unique name for the group.


ra re
fe (fik

b. Description: Enter a group-related description.


ns a
tra bs

7. Click Create. The group now appears in the list of groups.


n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

18 Identity and Access Management: Create IAM Components - Without Identity Domains Enabled
Create a Policy (Without Identity Domains Enabled)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

A policy is a document that specifies who can access which resources, and how.

In this practice, you’ll learn how to create a policy.

Tasks

1. Open the Main Menu and select Identity & Security. Under Identity, click Policies.

a
Choose a compartment.

. has
2.

A list of the policies in the compartment you’re currently viewing appears.

ide et)
3.

Gu v.
4. Click Create Policy.

is go
th a.
5. Enter the following:

e er
us @
a. Name: Enter a unique name for the policy.
to bsa
b. Description: Enter a policy-related description.
se .o
en m

c. Compartment: If you want to attach the policy to a compartment other than the one
lic aria

you’re viewing, select it from the drop-down list. Remember, where the policy is
ble m

attached controls who can later modify or delete it.


ra re
fe (fik

6. In the Policy Builder section, click Show manual editor and enter the policy statement.
ns a

Note: A sample statement would look like the following:


tra bs
n- O

allow group <group_name> to manage virtual-network-family in


no iam

compartment <compartment_name>
ar

7. Click Create. The policy now appears in the list of policies.


em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Identity and Access Management: Create IAM Components - Without Identity Domains Enabled 19
Create a Dynamic Group (Without Identity Domains
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Enabled)
A dynamic group is a special type of group that contains resources, such as compute
instances, which match rules that you define. This means that group membership can change
dynamically as matching resources are created or deleted. These instances serve as “principal”
actors and can make API calls to services according to policies that you write for the dynamic
group.

a
In this practice, you’ll learn how to create a dynamic group.

. has
Tasks

ide et)
Gu v.
Open the Main Menu and select Identity & Security. Under Identity, click Dynamic

is go
1.
Groups.

th a.
e er
Click Create Dynamic Group.

us @
2.
to bsa
3. Enter the following:
se .o

a. Name: Enter a unique name for the group. The name must be unique across all groups
en m

in your tenancy, including dynamic groups and user groups.


lic aria

b. Description: Enter a friendly description.


ble m
ra re

4. Enter the Matching Rules. Resources that meet the rule criteria are members of the
fe (fik

dynamic group.
ns a

a. Rule 1: Enter a rule by following the guidelines in https://docs.oracle.com/en-


tra bs

us/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#Writing
n- O

https://docs.oracle.com/en-
no iam

us/iaas/Content/Identity/Tasks/managingdynamicgroups.htm.
Note: You can manually enter the rule in the text box or launch the rule builder.
ar
em

− For example, to include all instances that are in a specific compartment, add a rule
kr

with the following syntax:


Fi

instance.compartment.id = '<compartment_ocid>'

b. Enter additional rules as needed. To add a rule, click +Additional Rule.

5. Click Create. The dynamic group now appears in the list of dynamic groups.

Copyright © 2023, Oracle and/or its affiliates.

20 Identity and Access Management: Create IAM Components - Without Identity Domains Enabled
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er Network
Lab 2-1 Practice
th a.
is go
Gu v.
ide et)
. has
a
Network: Create and
Configure a Virtual Cloud
Networking—Virtual Cloud
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

In this practice, you will configure and deploy a Virtual Cloud Network (VCN).

A VCN is a software-defined network specific to your OCI tenancy or a compartment in a


specified region.

a
Upon creation, a VCN automatically includes route tables, security lists (with default security

. has
rules), and a set of DHCP options. The VCN also has access to a DNS resolver.

ide et)
A VCN that is launched with the OCI VCN Wizard tool automatically creates the following:

Gu v.
• Public and Private Subnets

is go
• Internet Gateway (IG)

th a.
NAT Gateway (NAT)

e er

us @
• Service Gateway (SG)
to bsa
• Two Route Tables (RT)
se .o

• Two Security Lists (SL)


en m

• One CIDR Blocks/Prefixes


lic aria

• One DHCP Option


ble m
ra re

For more information about VCNs, see the OCI Networking Documentation:
fe (fik

https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/landing.htm
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

22 Virtual Cloud Network: Create and Configure a Virtual Cloud Network


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

a
. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
Prerequisites
se .o
en m

• You have access to the OCI Console.


lic aria

Assumptions
ble m
ra re

• In this lab, we are considering US East (Ashburn, Region Key – IAD) as your region.
fe (fik

• You must be familiar with navigating the OCI Console.


ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Virtual Cloud Network: Create and Configure a Virtual Cloud Network 23


Create a Virtual Cloud Network
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this lab, you will create a VCN and associated resources by using the VCN Wizard.

Tasks

1. Log in to the OCI Console.

2. In the Console ribbon at the top of the screen, click the Region icon to expand the menu.

a
Ensure that you are in the correct region, US East (Ashburn).

. has
3. Click the Main Menu, click Networking, and then click Virtual Cloud Networks.

ide et)
4. Click Start VCN Wizard.

Gu v.
is go
5. Select the Create VCN with Internet Connectivity option, and then click Start VCN

th a.
Wizard.

e er
us @
6. Enter the following values: to bsa
Name: IAD-FA-LAB02-VCN-01
se .o
en m
lic aria

Compartment: Select your <assigned compartment>.


ble m

7. Leave the default values for the remaining fields. Click Next.
ra re
fe (fik

8. Review and understand the list of resources that the OCI VCN Wizard will create. Notice
that the wizard will configure CIDR block ranges for VCN IP addresses, and for the public
ns a
tra bs

and private subnets. It will also set up security list rules and route table rules to enable
n- O

basic access to the VCN.


no iam

9. Click Create to start creating the VCN and its resources and wait for the VCN Wizard to
ar

successfully complete the VCN creation.


em

10. Click View Virtual Cloud Network to verify the creation of the VCN and its resources.
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

24 Virtual Cloud Network: Create and Configure a Virtual Cloud Network


You can see that the VCN is successfully created with the following components:
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

• VCN
• Public Subnet
• Private Subnet
• CIDR Blocks/Prefixes
• Route Tables
• Internet Gateway
• Security Lists

a
. has
• DHCP Options
• NAT Gateway

ide et)
• Service Gateway

Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Virtual Cloud Network: Create and Configure a Virtual Cloud Network 25


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

26
Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go
Gu v.
ide et)
. has
a

Virtual Cloud Network: Create and Configure a Virtual Cloud Network


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
Balancer

e er
Lab 3-1 Practice
th a.
is go
Gu v.
ide et)
. has
a
Networking: OCI Load
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

In this practice, you will configure a Public Load Balancer, including a set of two backend
compute instances.

Load Balancer

a
The OCI Load Balancer provides automated traffic distribution from one entry point to

. has
multiple backend servers in your VCN. It operates at the connection level and balances
incoming client connections to healthy backend servers. The service offers a load balancer

ide et)
with your choice of a regional public or private IP address and provisioned bandwidth.

Gu v.
is go
Summary of Components for OCI Load Balancer Used in This Lab

th a.
Listener: A logical entity that checks for incoming traffic on the load balancer’s IP

e er

us @
address

to bsa
Backend server: An application server responsible for generating content in reply to
the incoming traffic
se .o
en m

• Backend set: A logical entity defined by a list of backend servers


lic aria

• Load-balancing policy: Tells the load balancer how to distribute incoming traffic to
the backend servers
ble m
ra re

• Health check: A test to confirm the availability of backend servers


fe (fik

• Shape: The bandwidth capacity of the load balancer


ns a
tra bs

In this lab, you will:


n- O
no iam

a. Create a Virtual Cloud Network


ar

b. Create two compute instances


em

Create a load balancer


kr

c.
Fi

Copyright © 2023, Oracle and/or its affiliates.

28 OCI Load Balancer


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

a
. has
ide et)
Gu v.
is go
th a.
Prerequisites

e er
us @
• You have access to the OCI Console.
to bsa
Assumptions
se .o
en m

• In this lab, we are considering US East (Ashburn, Region Key – IAD) as your region.
lic aria

• You must be familiar with navigating the OCI Console.


ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

OCI Load Balancer 29


Create a Virtual Cloud Network
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will create a VCN and associated resources using the VCN Wizard.

Tasks

1. In the Console ribbon at the top of the screen, click the Regions icon to expand the menu.
Ensure that you are in the correct region, US East (Ashburn).

a
2. From the Main Menu, select Networking, and then click Virtual Cloud Networks.

. has
3. Click Start VCN Wizard.

ide et)
4. Select the Create VCN with Internet Connectivity option, and then click Start VCN

Gu v.
is go
Wizard.

th a.
Enter the following values:

e er
5.

us @
• Name: IAD-FA-LAB03-VCN-01
to bsa
• Compartment: Select your assigned <compartment name>.
se .o

• VCN CIDR Block: 172.17.0.0/16


en m

• Public Subnet CIDR Block: 172.17.0.0/24


lic aria

• Private Subnet CIDR Block: 172.17.1.0/24


ble m
ra re

6. Leave the default values for the remaining fields. Click Next.
fe (fik

7. Review and understand the list of resources that the OCI VCN Wizard will create. Notice
ns a
tra bs

that the wizard will configure CIDR block ranges for VCN IP addresses, and for the public
n- O

and private subnets. It will also set up security list rules and route table rules to enable
no iam

basic access to the VCN.


ar

8. Click Create.
em

When complete, click View Virtual Cloud Network.


kr

9.
Fi

10. In the left navigation pane, under Resources, click Security Lists.

11. Select Default Security List for IAD-FA-LAB03-VCN-01.

12. Click Add Ingress Rule.


a. For Source CIDR, enter 0.0.0.0/0.
b. For Destination Port Range, enter 80.
c. Click Add Ingress Rules.

Copyright © 2023, Oracle and/or its affiliates.

30 OCI Load Balancer


Create Two Compute Instances (Backend Servers)
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this lab, you will create two compute instances and configure them to provide web services.
They will serve as the backend servers, and will reside in a private subnet.

Task 1: Build the First Compute Instance

1. In the Console ribbon at the top of the screen, click the Regions icon to expand the menu.
Ensure that you are in the correct region, US East (Ashburn).

a
. has
2. From the Main Menu, select Compute, and then click Instances.

ide et)
3. In the left navigation pane, under List Scope, select your assigned <compartment name>.

Gu v.
is go
4. Click Create Instance and enter the following values:

th a.
• Name: IAD-FA-LAB03-VM-01

e er
• Compartment: Your assigned <compartment name>

us @
• Placement: AD-1 to bsa
• Image: Oracle Linux 8
se .o

• Shape: Click Change Shape.


en m
lic aria

• Instance Type: Virtual Machine


• Shape Series: Ampere
ble m
ra re

• Shape Name: VM.Standard.A1.Flex


fe (fik

• Leave Number of OCPU at one.


ns a

• Leave Amount of memory (GB) at six.


tra bs

• Click Select Shape.


n- O
no iam

• Networking:
• Primary network: Select existing Virtual Cloud Network.
ar
em

• Virtual Cloud Network in <assigned compartment>: IAD-FA-LAB03-VCN-01


• Subnet in <assigned compartment>: Private Subnet-IAD-FA-LAB03-VCN-01
kr
Fi

(regional)
• Add SSH Key: No SSH Keys
• Click Show advanced options.
• On the Management tab, click Paste cloud-init script under Initialization script.

Copyright © 2023, Oracle and/or its affiliates.

OCI Load Balancer 31


• Copy and paste the following into the Cloud-init script field
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

(Tip: Copy the below script in a notepad and ensure that the last 2 lines of the script
are copied in a single line as a single command):
#!/bin/bash -x
iptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
yum -y install httpd
systemctl enable httpd.service
systemctl start httpd.service
firewall-offline-cmd --add-service=http

a
firewall-offline-cmd --add-service=https

. has
systemctl enable firewalld

ide et)
systemctl restart firewalld
echo Hello World! My name is IAD-FA-LAB03-WS-01>

Gu v.
/var/www/html/index.html

is go
th a.
Note: This script configures and enables the compute instance’s firewall and httpd

e er
processes.

us @
to bsa
5. Click Create.
se .o

Note: The process will take approximately two minutes.


en m
lic aria
ble m
ra re

Task 2: Build the Second Compute Instance


fe (fik

1. In the console ribbon at the top of the screen, click the Regions icon to expand the menu.
ns a
tra bs

Ensure that you are in the correct region, US East (Ashburn).


n- O

2. From the Main Menu, select Compute, and then click Instances.
no iam
ar

3. In the left navigation pane, under List Scope, select your assigned <compartment name>.
em

4. Click Create Instance and enter the following values:


kr
Fi

• Name: IAD-FA-LAB03-VM-02
• Compartment: Your assigned <compartment name>
• Placement: AD-1
• Image: Oracle Linux 8
• Shape: Click Change Shape
• Instance Type: Virtual Machine
• Shape Series: Ampere

Copyright © 2023, Oracle and/or its affiliates.

32 OCI Load Balancer


• Shape Name: VM.Standard.A1.Flex
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

• Leave Number of OCPU at one.


• Leave Amount of memory (GB) at six.
• Click Select Shape.
• Networking:
• Primary network: Select existing Virtual Cloud Network.
• Virtual Cloud Network in <assigned compartment>: IAD-FA-LAB03-VCN-01
• Subnet in <assigned compartment>: Private Subnet-IAD-FA-LAB03-VCN-01

a
. has
(regional)
• Add SSH Key: No SSH Keys

ide et)
• Click Show advanced options.

Gu v.
• On the Management tab, click Paste cloud-init script under Initialization script.

is go
th a.
• Copy and paste the following into the Cloud-init script field:

e er
#!/bin/bash -x

us @
iptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
to bsa
yum -y install httpd
systemctl enable httpd.service
se .o
en m

systemctl start httpd.service


lic aria

firewall-offline-cmd --add-service=http
firewall-offline-cmd --add-service=https
ble m

systemctl enable firewalld


ra re

systemctl restart firewalld


fe (fik

echo Hello World! My name is IAD-FA-LAB03-WS-02>


/var/www/html/index.html
ns a
tra bs
n- O

Note: This script configures and enables the compute instance’s firewall and httpd
no iam

processes.
ar

5. Click Create.
em

Note: The process will take approximately two minutes.


kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

OCI Load Balancer 33


Create a Load Balancer
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this lab, you will create a Load Balancer, and configure the listener, the health check, and
backend set. You will then add a security rule to the security list of the private subnet.

Tasks

1. From the Main Menu, select Networking, and then click Load Balancers.

a
2. In the left navigation pane, under List Scope, select your assigned <compartment name>.

. has
3. Click Create Load Balancer.

ide et)
4. Select Load Balancer, click Create Load Balancer, and enter the following values:

Gu v.
is go
• Load Balancer Name: IAD-FA-LAB03-LB-01

th a.
• Choose visibility type: Public

e er
• Assign a public IP address: Ephemeral IP Address

us @
• to bsa
In the Bandwidth section, under Shapes, select Flexible Shapes.
• Under Choose Networking, for the Virtual Cloud Network in <compartment
se .o

name>, select IAD-FA-LAB03-VCN-01 and for the Subnet in <compartment


en m
lic aria

name>, select Public Subnet-IAD-FA-LAB03_VCN-01.


• Click Next.
ble m
ra re

• Under Choose Backends, select Weighted Round Robin.


fe (fik

• Click Add Backends.


ns a

• Select both IAD-FA-LAB03-VM-01 and IAD-FA-LAB03-VM-02.


tra bs

• Click Add Selected Backends.


n- O

Leave all values at defaults in the Specify Health Check Policy section.
no iam


Note: The default values will add a TCP port 80 rule to the security list for your
ar

private subnet.
em

• Click Next.
kr
Fi

• On the Configure Listener page, enter the following values:


• Listener Name: IAD-FA-LAB03-LISTENER-01
• Specify the type of traffic your listener handles: HTTP
Note: The Specify the port your listener monitors for ingress traffic value will
become 80.
• Click Next.
• On the Manage Logging page, set Error Logs to Not Enabled.

Copyright © 2023, Oracle and/or its affiliates.

34 OCI Load Balancer


5. Click Submit and wait for the status to become Active.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Note: The process will take approximately three minutes.

6. Verify that the Backend Set Health status is OK.

7. Locate and copy the Load Balancer’s IP Address.

8. Paste the copied value into your browser’s address bar to visit the site.

a
9. A webpage stating Hello World! My name is IAD-FA-LAB03-WS-01 will appear.

. has
10. Reload the page to see the other backend server has provided the message, Hello World!

ide et)
My name is IAD-FA-LAB03-WS-02.

Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

OCI Load Balancer 35


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

36
Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go
Gu v.
ide et)
. has
a

OCI Load Balancer


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @ Instance
e er
th a.
Lab 4-1 Practices
is go
Gu v.
ide et)
. has
a
Compute: Create a Web
Server on an OCI Compute
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

The Oracle Cloud Infrastructure (OCI) Compute lets you provision and manage compute hosts,
known as instances. You can launch instances as needed to meet your compute and
application requirements. In this lab, you will create a web server on a compute instance.

In this lab, you will:

a
• Launch Cloud Shell

. has
• Generate SSH keys

ide et)
• Create a Virtual Cloud Network and its components

Gu v.
• Create a compute instance

is go
• Install an Apache HTTP server on the instance

th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr

Prerequisites
Fi

• You have access to the OCI Console.

Assumptions
• In this lab, we are considering US East (Ashburn, Region Key – IAD) as your region.
• You must be familiar with navigating the OCI Console.

Copyright © 2023, Oracle and/or its affiliates.

38 Create a Web Server on a Compute Instance


Launch Cloud Shell
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

The OCI Cloud Shell is a web browser–based terminal accessible from the OCI Console. It
provides access to a Linux shell, with a pre-authenticated OCI CLI.

In this practice, you will access Cloud Shell via the OCI Console.

Tasks

a
1. Sign in to your Oracle Cloud Infrastructure Console.

. has
2. In the Console ribbon at the top of the screen, click the Region icon to expand the menu.

ide et)
Ensure that you are in the correct region, US East (Ashburn).

Gu v.
is go
3. Click the Cloud Shell icon next to the Region in the Console ribbon.

th a.
Note: The OCI CLI running in the Cloud Shell will execute commands against the region

e er
us @
selected in the Console's region selection menu when the Cloud Shell is started.
to bsa
This displays the Cloud Shell in a "drawer" at the bottom of the console.
se .o
en m

4. You can use the icons in the top-right corner of the Cloud Shell window to minimize,
lic aria

maximize, and close your Cloud Shell session.


ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Create a Web Server on a Compute Instance 39


Generate SSH Keys
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will generate SSH keys using Cloud Shell.

Tasks

1. From the OCI Console, click the Cloud Shell icon next to the region in the Console ribbon.

2. After the Cloud Shell has started, run the following commands:

a
$ mkdir .ssh

. has
Important: In case you get an error that says “cannot create director: File exists”, you can

ide et)
skip running the first command.

Gu v.
is go
$ cd .ssh

th a.
e er
$ ssh-keygen -b 2048 -t rsa –f <<sshkeyname>>

us @
to bsa
Replace <<sshkeyname>> with ocifalab4key. Select the key name you can remember.
This will be the key name you will use to connect to the compute instance you create.
se .o
en m

Note: If you receive an error message for the above command, enter the command
lic aria

manually.
ble m
ra re

Remember:
fe (fik

▪ After entering the third command, press Enter twice for no passphrase.
ns a
tra bs

▪ Do not include the angle brackets «» and $ symbol when pasting code into Cloud
n- O

Shell.
no iam

Examine the two files that you just created by running the following command:
ar

3.
em

$ ls
kr
Fi

Note: In the output, there are two files, a private key <<sshkeyname>> and a public
key <<sshkeyname>>.pub. Keep the private key safe and don’t share its contents with
anyone. The public key will be needed for various activities and can be uploaded to certain
systems as well as copied and pasted to facilitate secure communications in the cloud.

Copyright © 2023, Oracle and/or its affiliates.

40 Create a Web Server on a Compute Instance


4. To list the contents of the public key, run the following command:
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

$ cat <<sshkeyname>>.pub

Replace <<sshkeyname>> with ocifalab4key.

Note: The angle brackets «» should not appear in your code.

5. Copy the contents of the public key as you will require this in a subsequent step. Make
sure that you remove any hard returns that may have been added when copying.

a
The .pub key should be one line.

. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Create a Web Server on a Compute Instance 41


Create a Virtual Cloud Network and Its Components
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will create a Virtual Cloud Network (VCN), subnet, and Internet gateway
and add route rules in the route table.

Tasks

1. From the Main Menu, under Networking, click Virtual Cloud Networks.

a
2. Click Create VCN.

. has
3. In the Create a Virtual Cloud Network dialog box, populate the following information:

ide et)
a. Name: IAD-FA-LAB04-1-VCN-01

Gu v.
is go
b. Create in Compartment: <your compartment>

th a.
e er
IPv4 CIDR Blocks: 10.0.0.0/16 (Press Enter to add.)

us @
c.
to bsa
4. Keep the other options default and click Create VCN.
se .o

You can see that the VCN is created successfully.


en m
lic aria

5. Click IAD-FA-LAB04-1-VCN-01 VCN to view the details page.


ble m
ra re

6. Click Create Subnet.


fe (fik

7. In the Create Subnet dialog box, populate the following information:


ns a
tra bs

a. Name: IAD-FA-LAB04-1-SNET-01
n- O
no iam

b. Create in Compartment: <your compartment>


ar

Subnet Type: Regional


em

c.
kr

d. IPv4 CIDR Blocks: 10.0.1.0/24


Fi

e. Subnet Access: Public Subnet

8. Keep the other options default and click Create Subnet.

You can see that the subnet is created successfully, and the state is Available.

9. Under Resources in the left navigation panel, click Internet Gateways.

Copyright © 2023, Oracle and/or its affiliates.

42 Create a Web Server on a Compute Instance


10. Click Create Internet Gateway.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

11. In the Create Internet Gateway dialog box, populate the following information:

a. Name: IAD-FA-LAB04-1-IG-01

b. Create In Compartment: <your compartment>

12. Click Create Internet Gateway.

a
You can see that the Internet gateway is created successfully and the state is Available.

. has
13. Under Resources in the left navigation panel, click Route Tables.

ide et)
14. Click Default Route Table for IAD-FA-LAB04-1-VCN-01.

Gu v.
is go
15. Click Add Route Rules.

th a.
e er
16. In the Add Route Rules dialog box, populate the following information:

us @
to bsa
a. Target Type: Internet Gateway
se .o
en m

b. Destination CIDR Block: 0.0.0.0/0


lic aria

c. Target Internet Gateway: IAD-FA-LAB04-1-IG-01


ble m
ra re

17. Click Add Route Rules.


fe (fik

You can see that the route rule is successfully added in the default Route Table.
ns a
tra bs

18. Navigate back to the Virtual Cloud Networks page from the Main Menu.
n- O
no iam

19. Click IAD-FA-LAB04-1-VCN-01 VCN to view the details page.


ar

20. Under Resources in the left navigation panel, click Security Lists.
em
kr

21. Click Default Security List for IAD-FA-LAB04-1-VCN-01.


Fi

22. Here, you need to open port 80. Click Add Ingress Rules.

Copyright © 2023, Oracle and/or its affiliates.

Create a Web Server on a Compute Instance 43


23. In the Add Ingress Rules dialog box, populate the following information:
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

a. Source Type: CIDR

b. Source CIDR: 0.0.0.0/0

c. IP Protocol: TCP

d. Destination Port Range: 80

a
Note: Do not select the Stateless check box. The Source Port Range field is set to All by

. has
default.

ide et)
24. Click Add Ingress Rule.

Gu v.
is go
You can see that the route rule is successfully added.

th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

44 Create a Web Server on a Compute Instance


Create a Compute Instance
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will launch a compute instance and connect to it.

Tasks

1. From the OCI Console Main Menu, under Compute, click Instances.

2. Click Create instance.

a
In the Create compute instance dialog box, populate the following information:

. has
3.

Name: IAD-FA-LAB04-1-VM-01

ide et)
a.

Gu v.
Create in compartment: <your compartment>

is go
b.

th a.
c. Placement (Availability domain): AD 1

e er
us @
Click Show advanced options and select On-demand capacity under Capacity type.
to bsa
d. Image: Oracle Linux 8
se .o
en m

Shape: Click Change Shape and select the following:


lic aria

e.

Instance Type: Virtual Machine


ble m

1)
ra re
fe (fik

2) Shape Series: Ampere


ns a

3) Shape Name: VM.Standard.A1.Flex


tra bs
n- O

4) Leave Number of OCPU at one.


no iam

5) Leave Amount of memory (GB) at six.


ar
em

6) Click Select Shape.


kr
Fi

f. Primary network: Select an existing Virtual Cloud Network.

1) Virtual cloud network in <your compartment>: IAD-FA-LAB04-1-VCN-01

2) Subnet: Select an existing subnet.

3) Subnet in <your compartment>: IAD-FA-LAB04-1-SNET-01 (regional)

4) Public IP address: Assign a public IPv4 address.

Copyright © 2023, Oracle and/or its affiliates.

Create a Web Server on a Compute Instance 45


g. Add SSH keys: Paste public keys.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

h. SSH Keys: <public key> (Paste the public key which you copied in Step 5 of Generate
SSH Keys practice.)

Note: Keep the default option for Boot volume.

4. Click Create.

You will see that the instance is created successfully, and the state is Running.

a
. has
5. Copy the public IP corresponding to the IAD-FA-LAB04-1-VM-01 instance and paste it in
the Notepad.

ide et)
Gu v.
6. Click the Cloud Shell icon next to Region at the top of the screen.

is go
th a.
7. Run the following command using SSH to connect to your instance:

e er
us @
$ ssh -i <private_key_file> <username>@<public-ip-address>
to bsa
a. The /home/username/.ssh/private_key_file is the full path and name of the
se .o

file that contains the private key associated with the instance you want to access.
en m
lic aria

b. The <username> is the default user opc.


ble m

c. The <public-ip-address> is the public IP address of the instance.


ra re
fe (fik

Note: Enter yes in response to “Are you sure you want to continue connecting (yes/no)?”
ns a
tra bs

You are now connected to the instance IAD-FA-LAB04-1-VM-01.


n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

46 Create a Web Server on a Compute Instance


Install an Apache HTTP Server on the Instance
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

The HTTP server is an open-source web server developed by the Apache Software
Foundation. The Apache server hosts web content and responds to requests for this content
from web browsers such as Chrome or Firefox.

In this practice, you will install an Apache HTTP web server and connect to it over the public
Internet.

a
Tasks

. has
1. On the OCI Console, click the Cloud Shell icon at the top of the screen.

ide et)
Gu v.
2. While connected to your compute instance via SSH, run the following commands:

is go
Install Apache HTTP:

th a.
a.

e er
us @
$ sudo yum install httpd -y
to bsa
b. Start the Apache server and configure it to start after system:
se .o
en m

$ sudo apachectl start


lic aria

$ sudo systemctl enable httpd


ble m
ra re

c. Run a quick check on Apache configurations:


fe (fik

$ sudo apachectl configtest


ns a
tra bs

d. Create firewall rules to allow access to the ports on which the HTTP server listens:
n- O
no iam

$ sudo firewall-cmd --permanent --zone=public --add-


service=http
ar
em

$ sudo firewall-cmd --reload


kr

e. Create an index file for your web server.


Fi

$ sudo bash -c 'echo This is my Web-Server running on Oracle


Cloud Infrastructure >> /var/www/html/index.html'

Copyright © 2023, Oracle and/or its affiliates.

Create a Web Server on a Compute Instance 47


3. Open your browser and enter http://Public-IPAddress in the address bar (the IP
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

address of the compute instance).

You should see the index page of the web server we created in the second step (last point).

This is my Web-Server running on Oracle Cloud Infrastructure

a
. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

48 Create a Web Server on a Compute Instance


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er
th a.
Lab 5-1 Practices

is go
Gu v.
ide et)
. has
a
Object Storage: Create and
Manage OCI Object Storage
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

The Oracle Cloud Infrastructure (OCI) Object Storage provides unlimited capacity with high
durability and scalability. It is highly reliable and cost efficient. The object storage resources
include namespace, bucket, and object.

Object Storage is characterized by strong consistency and security with encryption. By

a
creating unlimited buckets, you can add as many objects as required with a maximum of 10TiB

. has
per object. In this lab, you will work on buckets, object versioning, object life cycle
management, replication policy, and retention rule.

ide et)
Gu v.
In this lab, you will:

is go
• Create an Object Storage bucket

th a.
e er
• Upload an object to a bucket

us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Prerequisites
• You have access to the OCI Console.

Assumptions
• In this lab, we are considering US East (Ashburn, Region Key – IAD) as your region.
• You must be familiar with navigating the OCI Console.

Copyright © 2023, Oracle and/or its affiliates.

50 Create and Manage OCI Object Storage


Create an Object Storage Bucket
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will create an Object Storage bucket.

Tasks

1. Sign in to your OCI account.

2. From the Main Menu, select Storage.

a
Under Object Storage and Archive Storage, click Buckets.

. has
3.

From the left navigation panel, select the compartment in which you have permission to

ide et)
4.
work. Then the page updates to display only the resources in that compartment.

Gu v.
is go
5. Click Create Bucket.

th a.
e er
6. In the Create Bucket dialog box, specify the following attributes of the bucket:

us @
to bsa
▪ Bucket Name: Enter IAD-FA-LAB05-1-BKT-01-xxx as the name for the bucket.
se .o

Specify a random number in place of xxx to make it unique.


en m
lic aria

▪ Default Storage Tier: Select the default tier in which you want to store the data. After
it is set, you cannot change the default storage tier of a bucket. When you upload
ble m

objects, this tier will be selected by default. You can, however, select a different tier. In
ra re

this case, select Standard, which is the primary and default storage tier used for Object
fe (fik

Storage.
ns a
tra bs

▪ Enable Auto-Tiering: Auto-Tiering helps you automatically move objects between


n- O

Standard and Infrequent Access tiers based on their access patterns. Do not enable this
no iam

field now.
ar

▪ Enable Object Versioning: Versioning directs Object Storage to automatically create


em

an object version each time a new object is uploaded, an existing object is overwritten,
kr

or when an object is deleted. You can enable it while creating a bucket or later. Do not
Fi

enable this field now.

▪ Emit Object Events: Emit Object Events lets the bucket emit events for object state
changes. Do not select this field now.

▪ Uncommitted Multipart Uploads Cleanup: Uncommitted Multipart Uploads Cleanup


allows deletion of uncommitted or failed multipart uploads. Do not select this field now.

Copyright © 2023, Oracle and/or its affiliates.

Create and Manage OCI Object Storage 51


▪ Encryption: Buckets are encrypted with keys managed by Oracle by default, but you
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

can optionally encrypt the data in this bucket using your own vault encryption key.
Select the Encrypt using Oracle managed keys option.

▪ Tags: If you have permissions to create a resource, then you also have permissions to
apply free-form tags to that resource. Skip this option. You can always apply tags later.

7. Click Create.

The bucket is created immediately, and you can add objects to it.

a
. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

52 Create and Manage OCI Object Storage


Upload an Object to a Bucket
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will upload an object to your bucket. Object Storage supports uploading
individual files up to 10 TiB.

Before you upload an object to a bucket, you must have a bucket. In this case, you will use the
bucket that is created from the previous practice.

Tasks

a
. has
1. In the Main Menu, navigate to Storage, and then select Buckets.

ide et)
2. Click the bucket IAD-FA-LAB05-1-BKT-01-xxx to view its details.

Gu v.
is go
3. Under Objects, click Upload.

th a.
In the Object Name Prefix field, enter the file name prefix oci/ for the files you plan to

e er
4.

us @
upload. This step is optional.
to bsa
5. The Storage Tier field is populated as Standard. You can optionally change the storage
se .o

tier (to Infrequent Access or Archive) to upload objects. In this case, keep it as Standard.
en m
lic aria

6. Select the objects to upload (browse any object from your local machine) by using one of
the following options:
ble m
ra re

▪ Drag files from your computer into the Drop files here... section.
fe (fik
ns a

▪ Click the Select Files link to display a file selection dialog box.
tra bs
n- O

As you select files to upload, they are displayed in a scrolling list. If you decide that you
no iam

do not want to upload a file that you have selected, click X to the right of the file name.
ar

If selected files to upload and files already stored in the bucket have the same name,
em

warning messages to overwrite are displayed.


kr
Fi

7. Click Upload.

The selected objects are uploaded. Click Close to return to the bucket.

Copyright © 2023, Oracle and/or its affiliates.

Create and Manage OCI Object Storage 53


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

54
Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go
Gu v.
ide et)
. has
a

Create and Manage OCI Object Storage


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er
th a.
Lab 6-1 Practices

is go
Gu v.
ide et)
. has
a
Attach a Block Volume
Block Storage: Create, and
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

The Oracle Cloud Infrastructure (OCI) Block Volume service lets you dynamically provision and
manage block storage volumes. You can create, attach, connect, and move volumes, as well as
change volume performance, as needed, to meet your storage, performance, and application
requirements.

a
In this lab, you will:

. has
a. Create a Virtual Cloud Network and its components

ide et)
Gu v.
b. Create a VM instance

is go
Create a block volume

th a.
c.

e er
us @
d. Attach a block volume to a compute instance
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Prerequisites
• You have access to the OCI Console.

Copyright © 2023, Oracle and/or its affiliates.

56 Create, Attach, Detach, and Resize a Block Volume


Assumptions
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

• In this lab, we are considering US East (Ashburn, Region Key – IAD) as your region.
• You must be familiar with navigating the OCI Console.

a
. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Create, Attach, Detach, and Resize a Block Volume 57


Create a Virtual Cloud Network and Its Components
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will learn how to create a Virtual Cloud Network (VCN), subnet, and
Internet gateway, and add route rules in the Route Table.

Tasks

1. Sign in to the OCI Console.

a
2. In the Console ribbon at the top of the screen, click the Region icon to expand the menu.

. has
Ensure that you are in the correct region, US East (Ashburn).

ide et)
3. From the Main Menu, select Networking, and then click Virtual Cloud Networks.

Gu v.
is go
4. Click Create VCN.

th a.
5. Enter the following:

e er
us @
a. Name: Enter IAD-FA-LAB06-1-VCN-01.
to bsa
b. Create in Compartment: Select the <compartment name> assigned to you.
se .o
en m

c. IPv4 CIDR Blocks: Type 10.0.0.0/16 and press Enter.


lic aria

Note: You can leave all the other options as default.


ble m
ra re

6. Click Create VCN. The VCN is now created successfully.


fe (fik

7. Click Create Subnet.


ns a
tra bs

In the Create Subnet dialog box, do the following:


n- O

8.
no iam

a. Name: Enter IAD-FA-LAB06-1-SNET-01.


ar
em

b. Create in Compartment: Select the <compartment name> assigned to you.


kr

c. Subnet Type: Select Regional.


Fi

d. IPv4 CIDR Blocks: Enter 10.0.1.0/24.

e. Subnet Access: Select Public Subnet.

Note: You can leave all the other options as default.

9. Click Create Subnet. The subnet is now created successfully, and the state is Available.

Copyright © 2023, Oracle and/or its affiliates.

58 Create, Attach, Detach, and Resize a Block Volume


10. In the left navigation pane, under Resources, click Internet Gateways.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

11. Click Create Internet Gateway.

12. Do the following:

a. Name: Enter IAD-FA-LAB06-1-IG-01.

b. Create in Compartment: Select the <compartment name> assigned to you.

a
13. Click Create Internet Gateway. The Internet gateway is now created successfully, and the

. has
state is Available.

ide et)
14. In the left navigation pane, under Resources, click Route Tables.

Gu v.
is go
15. Click Default Route Table for IAD-FA-LAB06-1-VCN-01.

th a.
e er
16. Click Add Route Rules and do the following:

us @
a. Target Type: Select Internet Gateway from the drop-down list.
to bsa
se .o

b. Destination CIDR Block: Enter 0.0.0.0/0.


en m
lic aria

c. Target Internet Gateway: Select IAD-FA-LAB06-1-IG-01 from the drop-down list.


ble m

17. Click Add Route Rules. The route rule is now successfully added to the default Route
ra re

Table.
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Create, Attach, Detach, and Resize a Block Volume 59


Create a VM Instance
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

In this practice, you will learn how to create SSH keys using Cloud Shell and how to launch an
instance.

Tasks

1. Sign in to the OCI Console.

a
2. In the Console ribbon at the top of the screen, click the Regions icon to expand the menu.

. has
Ensure that you are in the correct region, US East (Ashburn).

ide et)
3. In the Console ribbon at the top of the screen, click the Cloud Shell icon next to the

Gu v.
Region selection menu.

is go
Once the Cloud Shell is ready, enter the following commands:

th a.
4.

e er
us @
$ mkdir .ssh
to bsa
▪ Important: In case you get an error “Cannot create directory: File exists,” you can skip
se .o

running this first command.


en m
lic aria

$ cd .ssh
ble m

$ ssh-keygen -b 2048 -t rsa –f <<sshkeyname>>


ra re
fe (fik

▪ Remember: After entering this third command, press Enter twice for no passphrase.
ns a

Note: Replace <<sshkeyname>> with ocifalab6key. Choose a key name you can
tra bs

remember. This will be the key name you will use to connect to the compute instance you
n- O

create.
no iam
ar

Reminder: The angle brackets «» should not appear in your code.


em

Reminder: Do not include the $ symbol when pasting code into Cloud Shell.
kr
Fi

5. Examine the two files that you just created by running the following command:

$ ls

Note: In the output, there are two files, a private key <<sshkeyname>> and a public
key <<sshkeyname>>.pub. Keep the private key safe and don’t share its contents with
anyone. The public key will be needed for various activities and can be uploaded to certain
systems, as well as copied and pasted to facilitate secure communications in the cloud.

Copyright © 2023, Oracle and/or its affiliates.

60 Create, Attach, Detach, and Resize a Block Volume


6. To list the contents of the public key, use the following command:
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

$ cat <<sshkeyname>>.pub

Note: Replace <<sshkeyname>> with ocifalab6key.

Reminder: The angle brackets «» should not appear in your code.

7. Copy the contents of the public key as you will need this in a subsequent step. Make sure
that you remove any hard returns that may have been added when copying. The .pub

a
key should be one line.

. has
8. From the Main Menu, select Compute. Under Compute, click Instances.

ide et)
Gu v.
9. Click Create instance and do the following:

is go
Name: Enter IAD-FA-LAB06-1-VM-01.

th a.
a.

e er
us @
b. Create in compartment: Select the <compartment name> assigned to you.
to bsa
c. Placement: Select Availability Domain AD1. Click Show advanced options and select
se .o

On-demand capacity from the Capacity type menu.


en m
lic aria

d. Image: Select Oracle Linux 8.


ble m

e. Shape: Click Change Shape and select the following:


ra re
fe (fik

1) Instance Type: Virtual Machine


ns a
tra bs

2) Shape Series: Ampere


n- O

Shape Name: VM.Standard.A1.Flex


no iam

3)
ar

4) Leave Number of OCPU at one.


em

5) Leave Amount of memory (GB) at six.


kr
Fi

6) Click Select Shape.

f. Networking: Select the existing VCN IAD-FA-LAB06-1-VCN-01 and existing subnet


IAD-FA-LAB06-1-SNET-01 (regional). Under Public IP address, select Assign a
public IPv4 address.

g. Add SSH keys: Select Paste public keys and paste the contents of the public key,
which you copied in Step 6, in the box.

Copyright © 2023, Oracle and/or its affiliates.

Create, Attach, Detach, and Resize a Block Volume 61


h. Boot volume: Keep the default selection.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

10. Click Create.

Note: After a couple of minutes, you see that the instance is successfully created, and the
state is Running.

11. Under Instance access, copy the Public IP address.

12. Click the Cloud Shell icon to open Cloud Shell, and use SSH to connect to your instance
by using the following command:

a
. has
Note: Enter yes in response to “Are you sure you want to continue connecting (yes/no)?”

ide et)
$ ssh -i <private_key_file> <username>@<public-ip-address>

Gu v.
is go
Reminders:

th a.
e er
▪ /home/username/.ssh/private_key_file is the full path and name of the file

us @
that contains the private key associated with the instance you want to access.
to bsa
▪ <username> is the default user opc.
se .o
en m
lic aria

▪ <public-ip-address> is the public IP address of the instance.


ble m

13. You are now connected to the instance IAD-FA-LAB06-1-VM-01. Run the following
ra re

command to display information about the block devices:


fe (fik

$ lsblk
ns a
tra bs

Note: You will only see the boot disk sda.


n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

62 Create, Attach, Detach, and Resize a Block Volume


Create a Block Volume
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

The OCI Block Volume service lets you dynamically provision and manage block storage
volumes.

In this practice, you will learn how to create a block volume.

Tasks

a
1. Sign in to the OCI Console.

. has
2. Open the Main Menu and click Storage. Under Block Storage, click Block Volumes.

ide et)
3. Click Create Block Volume.

Gu v.
is go
4. Fill in the required volume information:

th a.
a. Name: Enter IAD-FA-LAB06-1-BV-01.

e er
us @
b. Create in Compartment: Select the <compartment name> assigned to you.
to bsa
c. Availability Domain: Select the first availability domain.
se .o
en m
lic aria

d. Volume Size and Performance: Select Custom and specify the following:
ble m

1) Volume Size (in GB): Enter 50.


ra re
fe (fik

2) Target Volume Performance: Drag the VPUs/GB slider to the left to make the
performance Lower Cost.
ns a
tra bs

e. Backup Policies: Do not specify any policy.


n- O
no iam

f. Cross Region Replication: Keep the OFF default selection.


ar
em

g. Encryption: Keep the default Encrypt using Oracle-managed keys selection.


kr

5. Click Create Block Volume. You now see that the Block Volume state becomes Available.
Fi

Copyright © 2023, Oracle and/or its affiliates.

Create, Attach, Detach, and Resize a Block Volume 63


Attach a Block Volume to a Compute Instance
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

You can create, attach, connect, and move volumes. You can also change volume
performance, as needed, to meet your storage, performance, and application requirements.
After you attach and connect a volume to an instance, you can use the volume like a regular
hard drive.

In this practice, you’ll learn how to attach a block volume to a compute instance and perform
various configuration tasks on the attached volume.

a
. has
Tasks

ide et)
1. Open the Main Menu and click Compute. Under Compute, click Instances.

Gu v.
is go
2. In the Instances list, click the instance IAD-FA-LAB06-1-VM-01.

th a.
e er
3. In the left navigation pane, under Resources, click Attached block volumes.

us @
4. Click Attach block volume. to bsa
se .o

5. Specify the volume you want to attach to. For example, to use the volume name,
en m

choose Select volume, and then select the volume IAD-FA-LAB06-1-BV-01 from
lic aria

the Volume drop-down list.


ble m

If the instance supports consistent device paths, and the volume you are attaching is not a
ra re

6.
fe (fik

boot volume, select the path /dev/oracleoci/oraclevdb from the Device path drop-
down list. This enables you to specify a device path for the volume attachment that
ns a
tra bs

remains consistent between instance reboots.


n- O

7. In the Attachment type section, select Paravirtualized.


no iam

Note: After you attach a volume using the Paravirtualized attachment type, it is ready to
ar
em

use, and you do not need to run any additional commands.


kr

8. In the Access section, select Read/Write.


Fi

Note: This is the default option for volume attachments and, with this option, an instance
can read and write data to the volume.

9. Click Attach. You now see the state as Attached and, since the attachment type
is Paravirtualized, you can use the volume without running any additional commands.

Copyright © 2023, Oracle and/or its affiliates.

64 Create, Attach, Detach, and Resize a Block Volume


10. Ensure that you are connected to the instance IAD-FA-LAB06-1-VM-01.
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Note: For help with this, refer to Step 11 in the Create a VM Instance practice.

11. Run the following command to display information about the block devices:

$ lsblk

Note: You now see that the system recognizes a new disk device, and the size is 50 GB.

a
12. To verify that the volume is attached to the instance, run the following command:

. has
$ ll /dev/oracleoci/oraclevd*

ide et)
13. To partition the disk using fdisk, run the following command:

Gu v.
is go
$ sudo fdisk /dev/oracleoci/oraclevdb

th a.
e er
Note: Enter the following responses as seen in Cloud Shell:

us @
a.
to bsa
Command (m for help): Enter n to create a new partition.
se .o

b. Select (default p): Enter p.


en m
lic aria

c. Partition number (1,4, default 1): Press Enter.


ble m

First sector: Press Enter.


ra re

d.
fe (fik

e. Last sector: Press Enter.


ns a
tra bs

f. Command (m for help): Enter w to write the new partition.


n- O
no iam

14. To format the partition, run the following command:


ar

$ sudo mkfs -t ext4 /dev/oracleoci/oraclevdb1


em

15. To mount the partition, run the following commands:


kr
Fi

$ sudo mkdir -p /mnt/volume1

$ sudo mount /dev/oracleoci/oraclevdb1 /mnt/volume1

Note: On Linux instances, if you want to automatically mount volumes on an instance


boot, you need to set some specific options in the /etc/fstab file.

Copyright © 2023, Oracle and/or its affiliates.

Create, Attach, Detach, and Resize a Block Volume 65


16. To display information about the block devices, run the following command:
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

$ lsblk

Note: You now see the partition and the mountpoint /mnt/volume1.

a
. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

66 Create, Attach, Detach, and Resize a Block Volume


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @
e er
th a.
Lab 7-1 Practices
is go
Gu v.
Security Zones

ide et)
. has
a
Zones Using Maximum
Security: Configure Security
Get Started
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Overview

Security zones enforce security posture on OCI cloud compartments and prevent actions that
can compromise a customer’s security posture. Security zone policies can be applied to
various cloud infrastructure types (network, compute, storage, database, and so on) to
guarantee cloud resources ensure security and to prevent potential misconfigurations.

a
In this lab, you will:

. has
a. Set up a security zone with Maximum Security Recipe

ide et)
Gu v.
b. View the security zone policies attached to a created security zone

is go
Test creating a bucket in an assigned compartment using an Oracle-managed key

th a.
c.

e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

68 Configure Security Zones using Maximum Security Zones


Prerequisites
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

• You have access to the OCI Console.


• Your tenancy should have Cloud Guard enabled.

Assumptions
• In this lab, we are considering US East (Ashburn) (IAD) as your region.

a
• You must be familiar with navigating the OCI Console.

. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Configure Security Zones using Maximum Security Zones 69


Set Up Security Zone with Maximum Security Recipe
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

You will create a security zone for an allocated compartment and check for any security zone
policy violations.

Tasks

1. Sign in to the OCI Console.

a
2. In the Console ribbon at the top of the screen, click the Region icon to expand the menu.

. has
Ensure that you are in the correct region, US East (Ashburn).

ide et)
3. From the navigation menu, select Identity & Security. Navigate to Security Zones, and

Gu v.
then click Overview.

is go
4. In the left navigation pane, under Scope, select <your assigned compartment> from the

th a.
e er
drop-down menu.

us @
to bsa
Note: The compartment should not be associated with a security zone. By default, all sub-
compartments are also in the same security zone.
se .o
en m

5. Click Create Security Zone.


lic aria

6. On the Create Security Zone page, enter the following values:


ble m
ra re

Security Zone Recipe: Select Oracle-managed to use Maximum Security Recipe.


fe (fik

a.
ns a

b. Name: IAD-FA-LAB07-1-SZ-01
tra bs
n- O

c. Description: My Security Zone


no iam

d. Create for compartment: <your assigned compartment>


ar
em

7. Click Create Security Zone.


kr

Note: When you create a security zone for a compartment, Cloud Guard does the
Fi

following:
• Deletes any existing Cloud Guard target for the compartment and for any child
compartments
• Creates a security zone target for the compartment
• Adds the default Oracle-managed detector recipes to the security zone target

Copyright © 2023, Oracle and/or its affiliates.

70 Configure Security Zones using Maximum Security Zones


View the Security Zone Policies Attached with a Created
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Security Zone
You will identify the recipe associated with the newly formed security zone, and then review its
policies.

1. From the navigation menu, select Identity & Security. Navigate to Security Zones, and
then click Overview.

a
2. In the left navigation pane, under Scope, select <your assigned compartment> from the

. has
drop-down menu.

ide et)
3. Click the IAD-FA-LAB07-1-SZ-01 security zone and view the Security Zone details page.

Gu v.
is go
4. On the Security Zone information tab, locate the attached recipe and click the Recipe for

th a.
this security zone: Maximum Security Recipe – 20200914.

e er
us @
5. View the Oracle-managed recipe attached to the Security Zone created on the Recipe
details page.
to bsa
se .o

6. View a few policy statements with associated Resource types:


en m
lic aria

deny public_subnets in VIRTUALNETWORK


deny public_buckets in OBJECTSTORAGE
ble m

deny buckets_without_vault_key in in OBJECTSTORAGE


ra re
fe (fik

Next, you will put a security zone to test by attempting to violate a few of its policies.
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Configure Security Zones using Maximum Security Zones 71


Verify Creating a Bucket in an Assigned Compartment
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

Using a Oracle-Managed Key


You will test the security zone. Create a bucket to check if it is restricted in the security zone.
As a reference, the security zone recipe has a policy that prohibits bucket creation without a
customer-managed vault key.

To create a bucket to observe the security zone violations:

a
1. Open the navigation menu and click Storage. Navigate Object Storage, click Buckets.

. has
2. In the left navigation pane, under List Scope, select the assigned compartment from the

ide et)
drop-down menu.

Gu v.
is go
3. Click Create Bucket.

th a.
e er
4. In the Create Bucket dialog box, specify the attributes of the bucket:

us @
a. to bsa
Bucket Name: IAD-FA-LAB07-1-BKT-01-<user-id>
Please specify your user ID in place of <user-id> to make it unique.
se .o
en m

Default Storage Tier: Standard


lic aria

b.
ble m

c. Encryption: Encrypt using Oracle-managed keys.


ra re
fe (fik

Note: Leave all the other options in their default setting.


ns a

Click Create.
tra bs

5.
n- O

You will receive an error indicating a security zone violation: “Encrypt the bucket with a
no iam

customer-managed encryption key”.


ar

6. Click Cancel.
em

The security zone recipe created earlier has a policy that prohibits bucket creation without a
kr
Fi

customer-managed key. You will need to create an OCI Vault and a master encryption key,
using which you can create a bucket. This way the security zone recipes enforce security
posture on OCI cloud compartments and prevent actions that could compromise the security
posture of a customer.

Note: Please purge the Security Zone created for this lab.

Copyright © 2023, Oracle and/or its affiliates.

72 Configure Security Zones using Maximum Security Zones


Purge Security Zone
Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

1. From the navigation menu, select Identity & Security. Navigate to Security Zones and
click Overview.

2. Make sure you are in your given compartment.

3. From the list of Security Zones, locate your Security Zone and click its name: IAD-FA-
LAB07-1-SZ-01.

a
4. Click Delete. Then click Delete in the Confirmation window.

. has
ide et)
Gu v.
is go
th a.
e er
us @
to bsa
se .o
en m
lic aria
ble m
ra re
fe (fik
ns a
tra bs
n- O
no iam
ar
em
kr
Fi

Copyright © 2023, Oracle and/or its affiliates.

Configure Security Zones using Maximum Security Zones 73


Unauthorized reproduction or distribution prohibited. Copyright© 2023, Oracle University and/or its affiliates.

74
Fi
kr
em
ar
no iam
n- O
tra bs
ns a
fe (fik
ra re
ble m
lic aria
en m
se .o
to bsa
us @

Copyright © 2023, Oracle and/or its affiliates.


e er
th a.
is go
Gu v.
ide et)
. has
a

Configure Security Zones using Maximum Security Zones

You might also like